Skip to content

Commit 9281fda

Browse files
authored
Merge pull request #108 from marty1885/master
Add more documentations
2 parents 36d00f0 + ef8aca0 commit 9281fda

File tree

7 files changed

+55
-11
lines changed

7 files changed

+55
-11
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ You can now explore HTM with modern, easy to use API and enjoy the performance b
1313

1414
* [More about Etaler](#more-about-etaler)
1515
* [Examples](#examples)
16+
* [Documentation](#documentation)
1617
* [Building and platform support](#building-and-platform-support)
1718
* [Dependencies](#dependencies)
1819
* [Building from source](#building-from-source)
@@ -76,7 +77,9 @@ Saving layers
7677
save(sp.states(), "sp.cereal");
7778
```
7879
79-
Documents are avalible online on [Read the Docs](https://etaler.readthedocs.io/en/latest)
80+
## Documentation
81+
82+
Documents are avalible online on [Read the Docs](https://etaler.readthedocs.io/en/latest).
8083
8184
## Building and platform support
8285
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Backends
1+
# Backend Design
22

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

docs/source/BuildOnLinux.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Building on Linux
2+
3+
Building Etaler on Linux should be easy as it is mainly developed on Linux.
4+
5+
## Using Docker
6+
7+
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.
8+
9+
```shell
10+
cd Etaler/docker
11+
cp ../.devcontainer/Dockerfile .
12+
# Build the library
13+
docker -D build --tag etaler:latest .
14+
# Run the container
15+
docker run --rm -it -e DISPLAY=:0 --cap-add=SYS_PTRACE --mount source=etaler-volume,target=/home etaler:latest
16+
```
17+
18+
## Building locally
19+
20+
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.
21+
22+
Here I show how to setup your system. You'll need to adapt the code if you are not using Arch Linux.
23+
24+
### Installing dependency
25+
26+
```shell
27+
sudo pacman -S gcc cmake catch2 cereal intel-tbb opencl-headers
28+
```
29+
30+
### Clone and build
31+
32+
```shell
33+
git clone https://github.com/Etaler/Etaler --recursive
34+
cd Etaler
35+
mkdir build && cd build
36+
cmake ..
37+
make -j4
38+
```

docs/source/BuildOnOSX.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ sudo wget https://www.khronos.org/registry/OpenCL/api/2.1/cl.hpp -P /System/Libr
3232
## Build Etaler
3333

3434
```shell
35-
git clone https://github.com/Etaler/Etaler
35+
git clone https://github.com/Etaler/Etaler --recursive
3636
cd Etaler
3737
mkdir build && cd build
3838
cmake ..

docs/source/Introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ Tensor z_1 = cat({x_1, y_1});
129129
cout << z_1 << endl;
130130

131131
// Concatenate columns:
132-
x_2 = zeros({2, 3});
133-
y_2 = zeros({2, 5});
134-
z_2 = cat({x_2, y_2}, 1);
132+
Tensor x_2 = zeros({2, 3});
133+
Tensor y_2 = zeros({2, 5});
134+
Tensor z_2 = cat({x_2, y_2}, 1);
135135
cout << z_2 << endl;
136136
```
137137

docs/source/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Be aware that Numenta holds the rights to HTM related patents. And only allows f
3333

3434
BuildOnMSVC
3535
BuildOnOSX
36+
BuildOnLinux
3637

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

5152
Contribution
52-
Backends
53+
BackendDesign
5354
DeveloperNotes
5455
OpenCLBackend
5556

tests/common_tests.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TEST_CASE("Testing Shape", "[Shape]")
3636
CHECK(s != n);
3737
}
3838

39-
SECTION("Shape comutation") {
39+
SECTION("Shape computation") {
4040
Shape stride = shapeToStride(s);
4141
CHECK(stride.size() == s.size());
4242
CHECK(stride == Shape({5,1}));
@@ -109,7 +109,7 @@ TEST_CASE("Testing Tensor", "[Tensor]")
109109
CHECK(q.dtype() == t.dtype());
110110
CHECK(q.shape() == t.shape());
111111
CHECK(q.backend() == t.backend());
112-
CHECK(q.shape() == zeros_like(t).shape()); //Lazy way to check if zeros_like works too
112+
CHECK(q.isSame(t) == true);
113113
}
114114

115115
SECTION("Tesnor basic") {
@@ -245,12 +245,12 @@ TEST_CASE("Testing Tensor", "[Tensor]")
245245
CHECK(t[r].isSame(t.view(r)));
246246
}
247247

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

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

265266
Tensor q = ones({2});
267+
// item() should fail because q is not a scalar
266268
CHECK_THROWS(q.item<int>());
267269
}
268270
}

0 commit comments

Comments
 (0)