Skip to content

willayy/modularml

Repository files navigation

ModularML

Coverage License: MIT Build GitHub Contributors

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.

Backend Implementations

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

Requirements

  • C++ Compiler
    • g++ GCC >= 12
    • Clang >= 10
  • Build Tools
    • Make
    • CMake >= 3.30

Install Dependencies

This command installs the neccessary dependencies needed to build the framework.

make install

Configure & Build The Framework

These 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_backends

This will show you a list of available and/or unavailable backends.

Run Tests

These commands will run all the unit and integration tests for the framework using the default naive GEMM backend.

cd build
ctest

Install using CMake Fetchcontent

A 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

Contributing

We welcome contributions!
Please read our Contributing Guide for instructions on how to get started.

License

This project is licensed under the MIT License.

Acknowledgments

This framework was developed as part of a Bachelor Thesis at Chalmers University of Technology.

About

Lightweight, transparent and modular ML Framework

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 8

Languages