ViNN is a cross platform MIT-licensed C++ library for training and evaluating artificial neural networks using OpenCL. ViNN parallelizes computationally intensive linear algebra routines using OpenCL, which provides significant performance gains over a single threaded CPU based implementation. Python bindings with NumPy integration ease developing new models and enable interoperability with existing tools and libraries.
The design goals for ViNN are
- correctness - use gradient checking, static analysis and strive for 100% unit test coverage
- modularity - for easy integration, extensibility and testing
- performance - optimize performance critical parts using OpenCL
ViNN ships with a CPU/C++ based and an OpenCL based linear algebra backend that supports most common matrix operations needed for neural networks and machine learning applications.
- Linear
- Sigmoid
- Softmax
- Hyperbolic Tangent
- Squared error
- Cross entropy
- Batch gradient descent with early stopping
- Stochastic/Minibatch gradient descent with early stopping
- L2 regularization
- Confusion table for binary classification
- Multiclass performance measures (average, micro, macro)
- CSV
- libsvm format
Integrating with a project:
- c++ compiler with c++11 support (clang or gcc >= 4.8)
- OpenCL 1.1 driver and development headers
- Swig 3
Additional dependencies when building from source:
- Ruby
- Python 3, NumPy
Additional dependencies for committers:
- clang-format
- lcov
brew install lcov
brew install clang-format
brew install swig
sudo apt-get install build-essential ocl-icd-libopencl1 opencl-headers ruby
sudo apt-get install gcc-4.8
sudo apt-get install g++-4.8
sudo apt-get install libgl1-mesa-dev
-
Create build directory & configure Debug build:
mkdir build cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
CC=gcc-4.8 CXX=g++-4.8 cmake -DCMAKE_BUILD_TYPE=Debug ..
-
Build library and unit tests
make
-
Run all tests:
make test # OR ctest
-
Run unit tests & generate coverage report
make coverage
-
Format source code after making changes:
make format
-
Build package
cpack --config CPackConfig.cmake
-
Build Python bindings
cd build/bindings/python python setup.py sdist pip install --global-option=build_ext --global-option="--swig-opts=-I/Users/ville/projects/vinn/src -c++" dist/vinnpy-0.2.0.tar.gz
cd build/bindings/python python setup.py build_ext --swig-opts="-I/Users/ville/projects/vinn/src -c++" bdist_wheel