A cpp/CUDA implementation of CAMASim, a comprehensive content-addressable accelerator simulation framework.
this repo is still under development
Using dev container is recommended. Steps:
- install
Dev Containersextension in vscode - install docker and nvidia-docker on host to enable contrainer and GPU access in container
- copy
./devcontainerto./.devcontainer - modify contents in dockerfile and json file, such as custom vscode extensions, etc.
- run vscode command
Dev Containers: Open Folder in Containerand select the current folder to open it
You can also setup a docker container with dockerfile devcontainer/Dockerfile for development environment.
Since CuCAMASim works with CUDA, you need to install CUDA on host and enable nvidia-docker on host.
The following content just follows the key setps in the dockerfile.
- Check CUDA and nvcc are installed
nvidia-smi
nvcc --version- Install necessary apt packages.
sudo apt-get update && apt-get install -y cmake make git gcc g++ gdb libhdf5-dev python-is-python3 python3-pip- Install matio library. The matio library is used to read mat files, which we use to store the dataset. You can check the matio github repo for more details.
git clone git://git.code.sf.net/p/matio/matio
cd matio
cmake .
cmake --build .
cmake --install .- Install python dependencies.
pip install --no-cache-dir numpy scipy scikit-learn pyyaml \
scikit-image pandas openml plotly tqdm redmail matplotlib \
black pytest ipykernel jupyterlab jupyterlab_code_formatter \
python-dotenv ucimlrepo torch torchvision torchaudioPlease remember to change the
WORKSPACE_DIRvariable in./.envto the root path of the repository.
The following procedure is only tested in Ubuntu 20.04.
CuCAMASim uses cmake to manage the project. The ./main.cpp provides an example on how to use CuCAMASim.
mkdir build && cd build
cmake ..
makeThen run ./build/CuCAMASim_runner to run the example.
CuCAMASim is a simulator for Content-Addressable Memory(CAM) and adopts a similar architecture as CAMASim[1].
We provide an example in which we use CuCAMASim to simulate ACAM-based decision tree inference process. Details could be found in this doc.
- add python - cpp interface
[1] M. Li, S. Liu, M. M. Sharifi, and X. S. Hu, “CAMASim: A Comprehensive Simulation Framework for Content-Addressable Memory based Accelerators.” arXiv, Mar. 05, 2024. Accessed: Mar. 07, 2024. [Online]. Available: http://arxiv.org/abs/2403.03442