Skip to content

rpelke/analog-cim-sim

Repository files navigation

Analog-CIM-Sim

CMake Style Python Coverage (lines)

Yet another simulator for executing matrix-vector multiplications on analog computing-in-memory crossbars.

If you use the code of this repository, please consider citing the corresponding paper:

@misc{pelke2025optimizingbinaryternaryneural,
    title={{Optimizing Binary and Ternary Neural Network Inference on RRAM Crossbars using CIM-Explorer}}, 
    author={Rebecca Pelke and José Cubero-Cascante and Nils Bosbach and Niklas Degener and Florian Idrizi and Lennart M. Reimann and Jan Moritz Joseph and Rainer Leupers},
    year={2025},
    eprint={2505.14303},
    archivePrefix={arXiv},
    primaryClass={cs.ET},
    url={https://arxiv.org/abs/2505.14303}, 
}

This simulator is used by CIM-E, a design space exploration tool for neural networks.

Build instructions

To build the project, you need cmake and a dev version of python. If you don't have python3-dev, pybind won't compile.

Clone the repository including submodules:

git clone --recursive [email protected]:rpelke/analog-cim-sim.git

Execute the following steps (replace the placeholders):

python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt

export PY_PACKAGE_DIR=<path to 'site-packages'> # can be found in .venv/lib/<python-version>

mkdir -p build/release/build && cd build/release/build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DPY_INSTALL_PATH=${PY_PACKAGE_DIR}/site-packages \
    -DCMAKE_PREFIX_PATH=${PY_PACKAGE_DIR}/pybind11/share/cmake/pybind11 \
    -DCMAKE_INSTALL_PREFIX=../ \
    -DLIB_TESTS=ON \
    -DBUILD_LIB_CB_EMU=ON \
    -DBUILD_LIB_ACS_INT=ON \
    ../../../cpp

make -j `nproc`
make install

Some useful cmake options

Build project with additional debug output:

cmake -DDEBUG_MODE=ON ...

Use C++17 filesystem features for the unittests with old gcc versions (<9.1):

cmake -DUSE_STDCXXFS=ON ...

Testing and debugging

Execute the tests:

python3 -m unittest discover -s int-bindings/test -p '*_test.py'

To detect segmentation faults in the C++ part, you can also run:

gdb --batch --ex="run" --ex="bt" --ex="quit" --args python3 -m unittest discover -s int-bindings/test -p '*_test.py'

About

Simulator for Executing Matrix-Vector Multiplications on Analog Computing-in-Memory Crossbars

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •