Skip to content

mikrl/matmul-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple handrolled implementation of matrix multiplication in C++ and Python bindings

  • C++ unit tests with gtest
  • Python bindings with pybind11
  • Python unit tests with unittest

Build

mkdir build

cd build

cmake ..

Make

Test C++ and CUDA routines

In the build dir:

ctest

If further granularity is required, the individual test executables can be called directly:

matmul_test && matutils_test

Python Bindings

mkdir bindings

g++ -O3 -Wall -shared -std=c++17 -fPIC -I extern/pybind11/include/pybind11 matmul_binding.cpp matmul.cpp matrix_utils.cpp -o bindings/matmul_handrolled.so `python3-config --cflags --ldflags`

Python Tests

In virtualenv with numpy, and after building bindings

python3 -m unittest discover -s tests

About

Some fun with matrix multiplication in C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published