Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Running SML in Galileo or Edison

Bruno Dilly edited this page Jul 5, 2016 · 11 revisions

In this page you'll be able to find information about how to build Soletta™ Machine Learning (SML) for Intel® Edison and Intel® Galileo Gen 2 using standard SDKs.

SML depends on three other projects that need to be built prior to it:

FANN and Fuzzylite are required for two different machine learning backends but if you just need one of them, it's fine, SML will detect dependencies on build time and only compile the appropriated backend.

Building Soletta

The first step is to build Soletta to the target platform.

Follow instructions in Building-Soletta-for-Intel®-Galileo-and-Intel®-Galileo-Gen2. 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.

Building dependencies

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.

Clonning SML repository - If you haven't done that before

[host] $ git clone [email protected]: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.

Building FANN

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.

Building Fuzzylite

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

Building SML

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

Installing dependencies and SML to target board

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
Clone this wiki locally