From 44bf333aa894b51e26b5a669c165cccff0480593 Mon Sep 17 00:00:00 2001 From: marty1885 Date: Mon, 25 Nov 2019 22:17:37 +0800 Subject: [PATCH 1/6] fix demo code --- docs/source/Introduction.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/Introduction.md b/docs/source/Introduction.md index a6e1863..a91f0de 100644 --- a/docs/source/Introduction.md +++ b/docs/source/Introduction.md @@ -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; ``` From 4be0fd04ddefb022123dc5b4c3fefd31dfa9b506 Mon Sep 17 00:00:00 2001 From: marty1885 Date: Mon, 25 Nov 2019 22:44:51 +0800 Subject: [PATCH 2/6] rename Backend -> BackendDesign --- docs/source/{Backends.md => BackendDesign.md} | 2 +- docs/source/index.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename docs/source/{Backends.md => BackendDesign.md} (99%) diff --git a/docs/source/Backends.md b/docs/source/BackendDesign.md similarity index 99% rename from docs/source/Backends.md rename to docs/source/BackendDesign.md index 313b237..213c3c7 100644 --- a/docs/source/Backends.md +++ b/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. diff --git a/docs/source/index.rst b/docs/source/index.rst index 132b311..985c77b 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -49,7 +49,7 @@ Be aware that Numenta holds the rights to HTM related patents. And only allows f :maxdepth: 2 Contribution - Backends + BackendDesign DeveloperNotes OpenCLBackend From 072a9bf48ea8346b37f2439c54cb4781ea5fa38d Mon Sep 17 00:00:00 2001 From: marty1885 Date: Tue, 26 Nov 2019 10:57:09 +0800 Subject: [PATCH 3/6] add Linux build instructions --- docs/source/BuildOnLinux.md | 38 +++++++++++++++++++++++++++++++++++++ docs/source/index.rst | 1 + 2 files changed, 39 insertions(+) create mode 100644 docs/source/BuildOnLinux.md diff --git a/docs/source/BuildOnLinux.md b/docs/source/BuildOnLinux.md new file mode 100644 index 0000000..119b378 --- /dev/null +++ b/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 +``` \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 985c77b..e8fa1a0 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -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 From 60d07018c06fc966f88c8d805b5dc242c82356df Mon Sep 17 00:00:00 2001 From: marty1885 Date: Tue, 26 Nov 2019 11:00:03 +0800 Subject: [PATCH 4/6] update OS X documents --- docs/source/BuildOnOSX.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/BuildOnOSX.md b/docs/source/BuildOnOSX.md index 1af26cd..1b39255 100644 --- a/docs/source/BuildOnOSX.md +++ b/docs/source/BuildOnOSX.md @@ -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 .. From bd6d92320e1ad3d379697d521de47022a29b5af0 Mon Sep 17 00:00:00 2001 From: marty1885 Date: Tue, 26 Nov 2019 11:46:00 +0800 Subject: [PATCH 5/6] fix typos in test --- tests/common_tests.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/common_tests.cpp b/tests/common_tests.cpp index 260398c..11ccd24 100644 --- a/tests/common_tests.cpp +++ b/tests/common_tests.cpp @@ -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})); @@ -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") { @@ -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() == 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() == 11); @@ -260,9 +260,11 @@ TEST_CASE("Testing Tensor", "[Tensor]") SECTION("item") { Tensor t = ones({1}); CHECK(t.item() == 1); + // item() should fail because asking for the wrong type CHECK_THROWS(t.item()); Tensor q = ones({2}); + // item() should fail because q is not a scalar CHECK_THROWS(q.item()); } } From ef8aca076fed5143f7788f31301d01e69b8c3d6f Mon Sep 17 00:00:00 2001 From: marty1885 Date: Tue, 26 Nov 2019 11:55:59 +0800 Subject: [PATCH 6/6] update README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e7b49d..b9db7ca 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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