This project provides tools to simulate and evaluate neural network (NN) inference using crossbar arrays. The simulations focus on key performance metrics such as NN accuracy, chip-level power consumption, hardware inference time, and hardware area.
Define your model architecture and dataset in ./models
Configure simulation parameters in inferenceConfig.py, note that this config will only effect inference!
Run the simulation script:
python inference_sim.py
It will generate NN traces (each layer's output), saved in "./layer_record_[NN]/", these traces will be used in NeuroPySim core program, to calculate power, latency and area.
cd from_neurosim
mkdir build
cd build
cmake ..
make
This creates the FormulaBindings.so shared object file, which allows Python scripts to access NeuroSIM parameters and formulas.
python Chip.py
This script calculates:
- Chip Area
- Inference Time
- Energy Consumption
- Performance Breakdown for crossbar arrays
./from_neurosim/param.cpp: param defined by NeuroSIM../from_neurosim/bindings.cpp: bind the NeuroSIM's formula.cpp to python.
- Check Memory cell read energy in
Array.py. - Check Memory cell write energy in
Tile.py.
- Check Memory cell read latency in
Array.py. - Check Memory cell write latency in
Tile.py.
- Check
Array.py.
- Check each class.
NeuroSIM v1.4 (inference)
NeuroSIM v2.0 (train)
Python > 3.10
Pybind11
torch
numpy
- Acc.: Related.
- Read Power: Related, activity rows of input vectors only.
- Write Energy: Related, Weight matrix before and after update.
- Latency: Related, numbit of input only.
- Area: Not related.