Blom is a subset of YDF(Yggdrasil Decision Forests) that runs the following algorithms:
- CART
- Decision Tree
- Random Forest
Specifically, Blom aims to be a library that can be easily compiled for both ARM and Android with minimal setup.
There are various ways to get started with Blom:
-
on the command-line with vim(or its variants).
-
using an IDE such as Visual studio code(with CMake plugins) or JetBrains CLion.
-
using Docker with the enclosed Dockerfile. Ideal if you need an isolated build environment and have some knowledge of Docker.
If you opt to use docker, you can safely skip installing the prequisites and go to step 4.
-
CMake
-
Ninja
-
Build-essentials i.e c++, make e.tc
- Configure the project
cmake --preset=linux.x64-debug -S .
- Build the project
cmake --build --preset=linux.x64-debug
- Run example executable;
cd builds/linux.x64-debug/example
./example
-
Docker only steps:
a. Build the image
docker build -t blom .
b. Run the image
docker run -v $(pwd):/home/workspace/blom -u $(id -u):$(id -g) -it blom /bin/bash
c. On the container prompt, build the project
cmake --preset=linux.x64-debug -S . && cmake --build --preset=linux.x64-debug
I would recommend using Visual studio.
-
Visual Studio 22 community or pro.
-
Visual studio "Desktop Development with c++" workload installed. This is available as part of the installer. The workload will enable support for CMake projects.
-
Start Visual studio and select "Open a local folder".
-
Select folder where you have cloned the project.
-
Wait for Visual studio to setup the project dependencies.
-
On project menu "build all"
-
On folder view change, select "CMake target view" to select targets. Search for "example" executable and set as default.
For more information refer to Visual Studio documentation on CMake.
-
Not all project dependencies were downloaded:
Go to project menu and "Delete cache and Reconfigure".
-
Test discovery timeout:
Go to test menu options and adjust the timeout for Google test discovery.
-
If issues still persist:
(re)configure and build the project manually by going to "view menu", opening a terminal and running the following commands.
a. Check your terminal prompt has the project directory set as the default directory.
b. Check cmake is installed;
cmake --version
c. Remove the "builds" directory, if it exists.
d. Configure the project;
cmake --preset=windows.x64-debug -S .
e. Build example;
cmake --build --preset=windows.x64-debug --target example
f. Or build all;
cmake --build --preset=windows.x64-debug
You can cross-compile the Blom for ARM or Android; however only the Android configurations are provided.
-
Android NDK OR
-
ARM GCC cross-compiler
-
To cross compile for ARM you will also need to create a
CMakeUserPreset.json
and a toolchain file. CMake documentation is an excellent resource.
-
Add to the environment the variable
CMAKE_ANDROID_NDK
pointing to the root directory of Android NDK.Without this environment variable CMake will not enable the Android presets.
-
Phase 1: build all, in this case on a linux host.
cmake --preset=linux.x64-debug -S . && cmake --build --preset=linux.x64-debug
If on windows replace
linux
withwindows
.This step is necessary in order to generate the required protocol buffer C++ source files.
-
Phase 2: build for Android
cmake --preset=android.v8a-debug -S . && cmake --build --preset=android.v8a-debug
For more options, review projects preset file.