fff-rs / juice

The Hacker's Machine Learning Engine
1.11k stars 76 forks source link
agnostic coaster cuda extinsible framework hacktoberfest juice machine-learning opencl rust

Juice

This is the workspace project for

Juice Examples

CLI for running juice examples. More examples and benchmark tests can be found at the juice examples directory.

Install CLI

DISCLAIMER: Currently both CUDA and cuDNN are required for the examples to build.

Compile and call the build.

# install rust, if you need to
curl -sSf https://static.rust-lang.org/rustup.sh | sh
# download the code
git clone git@github.com:spearow/juice.git && cd juice/juice-examples
# build the binary
cargo build --release
# and you should see the CLI help page
../target/release/juice-examples --help
# which means, you can run the examples from the juice-examples README

Dependencies

Cap'n'Proto

capnproto is a data interchange format that is used to store and load networks with weights for Juice.

capnproto and capnproto-libs plus their development packages are the ones needed from your package manager.

Cuda

Getting the cuda libraries up poses to be the first road-block many users face.

To get things working one needs to set the following environment variables:

# examplary paths, unlikely to work for your local setup!
export CUDNN_INCLUDE_DIR=/opt/cuda/include
export CUDNN_LIB_DIR=/opt/cuda/targets/x86_64-linux/lib/
export CUBLAS_INCLUDE_DIR=/opt/cuda/include
export CUBLAS_LIB_DIR=/opt/cuda/targets/x86_64-linux/lib/

depending on your local installation setup.

The currently supported cuda version is cuda-11 (details in #114 and #115 )

Note that you need a capable nvidia device in order to run the cuda backend.

OpenCL

You need the apropriate loader and device libraries. Since the OpenCL backend is still WIP, this will be detailed at a later point of time.

BLAS

Blas is a linear algebra used by the native backend.

openblas or blas is required to be present. Choose explicitly via BLAS_VARIANT.

By default an attempt is made to resolve the library via pkg-config.

Overriding via

# examplary paths, unlikely to work for your local setup!
export BLAS_LIB_DIR=/opt/blas/lib64/
export BLAS_INCLUDE_DIR=/opt/blas/include/

is also supported.

Linkage for the blas library variant is determined by setting BLAS_STATIC to 1 or unsetting BLAS_STATIC.

ArchLinux users

ArchLinux openblas package doesn't include LAPACK symbols (see FS#66092), so if you try to use it, you'll get multiple cblas_* unresolved symbols.

Replace openblas with AUR's openblas-lapack package to fix.