We proposed "TorchAxf: Enabling Rapid Simulation of Approximate DNN Models using GPU-based Floating-Point Computing Framework" in MASCOTS 2023.
TorchAxf: a floating-point computing framework developed to accelerate the emulation of approximate Deep Neural Network (DNN) models, including Spiking Neural Networks (SNNs). Leveraging PyTorch and CUDA for GPU acceleration, TorchAxf provides a comprehensive environment for integrating various types of approximate adders and multipliers, supporting both standard and custom floating-point formats.
TorchAxf is capable of computing PyTorch's conv1d and conv2d functions using approximate floating-point arithmetic.
Provide CNN models:
Pytorch: ResNet, VGGNet, DenseNet, GoogleNet, Inception-v3, MobileNetv2
Models are not provided, however, they can be easily applied and thoroughly tested within the TorchAxf framework.:
SpykeTorch(SDNN, DCSNN, R-STDP): https://github.com/miladmozafari/SpykeTorch
SENet: https://github.com/moskomule/senet.pytorch
AdderNet: https://github.com/huawei-noah/AdderNet
This manual was written based on Ubuntu 20.04 with Docker, Pytorch and CUDA 11.8. And you need an NVIDIA GPU (over 8GB GPU memory).
Before configuring your environment, check if your GPU driver is the latest version suitable for PyTorch, and update it if necessary.
Pytorch docker image download and run
$ docker pull pytorch/pytorch:2.1.2-cuda11.8-cudnn8-devel
$ docker run -it --gpus all --name TorchAxf -w /home -dt pytorch/pytorch:2.1.2-cuda11.8-cudnn8-devel /bin/bash
$ docker exec -it TorchAxf /bin/bash
require package install in docker container
$ apt-get update
$ apt-get install wget vim git unzip -y
$ pip3 install pynvrtc tqdm cupy-cuda11x
$ git clone https://github.com/KNUSCENT/TorchAxf.git
$ cd TorchAxf
pre-trained weight TorchAxf used pre-trained weight by Huy Phan (https://github.com/huyvnphan/PyTorch_CIFAR10/tree/master)
cd models
wget https://rutgers.box.com/shared/static/gkw08ecs797j2et1ksmbg1w5t3idf5r5.zip
unzip gkw08ecs797j2et1ksmbg1w5t3idf5r5.zip
rm gkw08ecs797j2et1ksmbg1w5t3idf5r5.zip
cd ..
run command
python3 Test_Approximaet_[model name].py // approximate FP model
python3 Test_Native_[model name].py // original model
You can modify the floating-point (FP) formats, as well as the approximate adder and multiplier, in the '/models/custom/custom_HW.cu' and '/models/custom/custom_conv2d.cu'