-
Notifications
You must be signed in to change notification settings - Fork 108
Running SML in Galileo or Edison
The first step is to build Soletta to the target platform.
Follow instructions in Galileo and Galileo Gen2 Instructions. For Edison board, follow the same instructions, but using the "Edison SDK - Cross Compile Tools", that can be found in the official Edison download page.
Keep the tarball used to install Soletta in target board, because it is going to be used later.
Now, using the same environment settings used to build Soletta, we are going to build 2 SML dependencies, fann and fuzzylite. See https://github.com/solettaproject/soletta/wiki/Getting-Started-on-SML#building for more information about dependencies.
Note: Installing CMake building system is required to perform next steps.
[host] $ git clone git@github.com:solettaproject/soletta-machine-learning.git
[host] $ cd soletta-machine-learning
SML provides 2 toolchain cmake files. These files help cmake to find the correct compiler for each board: edison-toolchain.cmake and galileo-toolchain.cmake. Edit the file for your target platform and change the CMAKE_FIND_ROOT_PATH with the path of ROOT sysdir of the installed SDK.
Clone FANN:
[host] $ git clone https://github.com/libfann/fann.git
Checkout correct FANN version:
[host] $ cd fann
[host] $ git checkout 2.2.0 #Version used by SML
Build FANN:
[host] $ cmake . DCMAKE_TOOLCHAIN_FILE={SML repository path}/soletta_module/{target platform}-toolchain.cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr
[host] $ make
Create FANN tarball:
[host] $ make install DESTDIR={FANN_TMP_DIR}
[host] $ cd {FANN_TMP_DIR}
[host] $ tar cvf fann.tar *
Save fann.tar to be used later.
Clone Fuzzylite:
[host] $ git clone https://github.com/fuzzylite/fuzzylite.git
Checkout correct Fuzzylite version:
[host] $ cd fuzzylite/fuzzylite
[host] $ git checkout v5.0 #Version used by SML
Edit fuzzylite.pc.in file and change libdir line to
libdir=${exec_prefix}/lib
and Cflags line to
Cflags: -I${includedir}
Build Fuzzylite:
[host] $ cmake . -DCMAKE_TOOLCHAIN_FILE={SML repository path}/soletta_module/{target platform}-toolchain.cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr
[host] $ make
Create Fuzzylite tarball:
[host] $ make install DESTDIR={FUZZYLITE_TMP_DIR}
[host] $ cd {FUZZYLITE_TMP_DIR}
[host] $ tar cvf fuzzylite.tar *
Save fuzzylite.tar to be used later
Before building SML we need to install Soletta, FANN and Fuzzylite to the SDK sysdir, using the tarballs saved in previous steps.
List all sysdirs from target SDK
[host] $ cd {SDK_PATH}/sysdirs
[host] $ ls
For each sysdir found, install dependencies:
[host] $ cd {SDK_PATH}/sysdirs/{sysdir}
[host] $ tar xvf soletta.tar
[host] $ tar xvf fann.tar
[host] $ tar xvf fuzzylite.tar
Building SML:
[host] $ cd {SML repository path}
[host] $ cmake . DCMAKE_TOOLCHAIN_FILE=soletta_module/{target platform}-toolchain.cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILD_EXAMPLES=OFF -DBUILD_SIMULATOR=OFF -DMAINLOOP=OFF
[host] $ make
Create SML tarball:
[host] $ make install DESTDIR={SML_TMP_DIR}
[host] $ cd {SML_TMP_DIR}
[host] $ tar cvf sml.tar *
Save sml.tar to be used later
Copy soletta.tar, fann.tar, fuzzylite.tar and sml.tar to the target board.
Extract the tarballs:
[target] $ cd /
[target] $ tar xvf soletta.tar
[target] $ tar xvf fann.tar
[target] $ tar xvf fuzzylite.tar
[target] $ tar xvf sml.tar
And that's it. To test SML copy any fbp sample from {SML repository path}/soletta_module/samples to target board and run it using sol-fbp-runner
. For example:
[target] $ cd soletta-machine-learning/soletta_module/samples/foosball/
[target] $ SOL_FLOW_MODULE_RESOLVER_CONFFILE=edison_fuzzy.json sol-fbp-runner foosball_limited.fbp