Skip to content

Commit

Permalink
Merge pull request #108 from marty1885/master
Browse files Browse the repository at this point in the history
Add more documentations
  • Loading branch information
marty1885 committed Nov 26, 2019
2 parents 36d00f0 + ef8aca0 commit 9281fda
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 11 deletions.
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -13,6 +13,7 @@ You can now explore HTM with modern, easy to use API and enjoy the performance b

* [More about Etaler](#more-about-etaler)
* [Examples](#examples)
* [Documentation](#documentation)
* [Building and platform support](#building-and-platform-support)
* [Dependencies](#dependencies)
* [Building from source](#building-from-source)
Expand Down Expand Up @@ -76,7 +77,9 @@ Saving layers
save(sp.states(), "sp.cereal");
```
Documents are avalible online on [Read the Docs](https://etaler.readthedocs.io/en/latest)
## Documentation
Documents are avalible online on [Read the Docs](https://etaler.readthedocs.io/en/latest).
## Building and platform support
Expand Down
2 changes: 1 addition & 1 deletion docs/source/Backends.md → docs/source/BackendDesign.md
@@ -1,4 +1,4 @@
# Backends
# Backend Design

Backends are how Etaler supports computing on different device/processors. They perform the actual computing and memory managment. Currently there are 2 backends avaliable.

Expand Down
38 changes: 38 additions & 0 deletions docs/source/BuildOnLinux.md
@@ -0,0 +1,38 @@
# Building on Linux

Building Etaler on Linux should be easy as it is mainly developed on Linux.

## Using Docker

Etaler's repo ships with a Docerfile in the `.devcontainer` directory. You can copy the file into the docker folder and utilize docker for an easy build.

```shell
cd Etaler/docker
cp ../.devcontainer/Dockerfile .
# Build the library
docker -D build --tag etaler:latest .
# Run the container
docker run --rm -it -e DISPLAY=:0 --cap-add=SYS_PTRACE --mount source=etaler-volume,target=/home etaler:latest
```

## Building locally

If you are like me - want to use the library locally on the system and/or want to deploy it to an embedded system, Docker may not be an option for you. No worries, building locally is also very easy.

Here I show how to setup your system. You'll need to adapt the code if you are not using Arch Linux.

### Installing dependency

```shell
sudo pacman -S gcc cmake catch2 cereal intel-tbb opencl-headers
```

### Clone and build

```shell
git clone https://github.com/Etaler/Etaler --recursive
cd Etaler
mkdir build && cd build
cmake ..
make -j4
```
2 changes: 1 addition & 1 deletion docs/source/BuildOnOSX.md
Expand Up @@ -32,7 +32,7 @@ sudo wget https://www.khronos.org/registry/OpenCL/api/2.1/cl.hpp -P /System/Libr
## Build Etaler

```shell
git clone https://github.com/Etaler/Etaler
git clone https://github.com/Etaler/Etaler --recursive
cd Etaler
mkdir build && cd build
cmake ..
Expand Down
6 changes: 3 additions & 3 deletions docs/source/Introduction.md
Expand Up @@ -129,9 +129,9 @@ Tensor z_1 = cat({x_1, y_1});
cout << z_1 << endl;

// Concatenate columns:
x_2 = zeros({2, 3});
y_2 = zeros({2, 5});
z_2 = cat({x_2, y_2}, 1);
Tensor x_2 = zeros({2, 3});
Tensor y_2 = zeros({2, 5});
Tensor z_2 = cat({x_2, y_2}, 1);
cout << z_2 << endl;
```
Expand Down
3 changes: 2 additions & 1 deletion docs/source/index.rst
Expand Up @@ -33,6 +33,7 @@ Be aware that Numenta holds the rights to HTM related patents. And only allows f

BuildOnMSVC
BuildOnOSX
BuildOnLinux

.. toctree::
:maxdepth: 2
Expand All @@ -49,7 +50,7 @@ Be aware that Numenta holds the rights to HTM related patents. And only allows f
:maxdepth: 2

Contribution
Backends
BackendDesign
DeveloperNotes
OpenCLBackend

Expand Down
10 changes: 6 additions & 4 deletions tests/common_tests.cpp
Expand Up @@ -36,7 +36,7 @@ TEST_CASE("Testing Shape", "[Shape]")
CHECK(s != n);
}

SECTION("Shape comutation") {
SECTION("Shape computation") {
Shape stride = shapeToStride(s);
CHECK(stride.size() == s.size());
CHECK(stride == Shape({5,1}));
Expand Down Expand Up @@ -109,7 +109,7 @@ TEST_CASE("Testing Tensor", "[Tensor]")
CHECK(q.dtype() == t.dtype());
CHECK(q.shape() == t.shape());
CHECK(q.backend() == t.backend());
CHECK(q.shape() == zeros_like(t).shape()); //Lazy way to check if zeros_like works too
CHECK(q.isSame(t) == true);
}

SECTION("Tesnor basic") {
Expand Down Expand Up @@ -245,12 +245,12 @@ TEST_CASE("Testing Tensor", "[Tensor]")
CHECK(t[r].isSame(t.view(r)));
}

SECTION("assign to subscription") {
SECTION("assign to subscription (scalar)") {
t[{2, 2}] = t[{2, 2}] + 1;
CHECK(t[{2, 2}].item<int>() == 11);
}

SECTION("self increment and assign") {
SECTION("assign to subscription (vector)") {
t[{2}] = t[{2}] + 1;
//Check a subset of weather the result is correct
CHECK(t[{2, 2}].item<int>() == 11);
Expand All @@ -260,9 +260,11 @@ TEST_CASE("Testing Tensor", "[Tensor]")
SECTION("item") {
Tensor t = ones({1});
CHECK(t.item<int>() == 1);
// item() should fail because asking for the wrong type
CHECK_THROWS(t.item<float>());

Tensor q = ones({2});
// item() should fail because q is not a scalar
CHECK_THROWS(q.item<int>());
}
}
Expand Down

0 comments on commit 9281fda

Please sign in to comment.