ModularML is a machine learning framework with the aim to let users more easily load, explore and experiment with ML models as to foster a greater understanding behind the underlying processes that make machine learning possible.
The framework loads already trained models using the onnx format, the onnx file is then translated into JSON which the framework uses during runtime to construct the model internally. The user is then to run inference on the model by feeding the model some input data.
Machine learning entails heavy use of General Matrix Multiplication (GEMM) to perform calculations. ModularML provides several interchangeable backend implementations for executing these efficiently. Current backend implementations include:
- Naive GEMM Backend A simple reference implementation. Good for understanding the computation step-by-step.
- Blocked GEMM Backend Optimized for cache locality by processing matrices in smaller blocks.
- AVX2 GEMM Backend Uses AVX2 SIMD intrinsics to faster computation on supported CPU:s.
- AVX512 GEMM Backend Uses AVX512 SIMD intrinsics to even faster computation on supported CPU:s.
- CUDA GEMM Backend Uses CUDA for computation on supported GPU:s
- C++ Compiler
- g++
GCC >= 12 - Clang
>= 10
- g++
- Build Tools
- Make
- CMake
>= 3.30
This command installs the neccessary dependencies needed to build the framework.
make installThese commands will configure and build the framework using the default naive GEMM backend.
cd build
cmake ..
make -j[Number of cores]To build the framework using the blocked GEMM backend for example:
cd build
cmake -DBUILD==blocked ..
make -j[Number of cores]To check which backends are available on your system:
make check_backendsThis will show you a list of available and/or unavailable backends.
These commands will run all the unit and integration tests for the framework using the default naive GEMM backend.
cd build
ctestA library version of ModularML where you can change operation implementations dynamically can be installed by putting
# ----------------------- MODULARML -------------------------- #
include(FetchContent)
FetchContent_Declare(
modularml
GIT_REPOSITORY https://github.com/willayy/modularml-lib
GIT_TAG <use latest release tag>
)
FetchContent_MakeAvailable(modularml)
target_link_libraries(MyProject PRIVATE modularml)
# ------------------------------------------------------------ #In your CMakeLists.txt file, for information about its specific usage check https://github.com/willayy/modularml-lib
We welcome contributions!
Please read our Contributing Guide for instructions on how to get started.
This project is licensed under the MIT License.
This framework was developed as part of a Bachelor Thesis at Chalmers University of Technology.