GithubHelp home page GithubHelp logo

torchaxf's Introduction

TorchAxf

We proposed "TorchAxf: Enabling Rapid Simulation of Approximate DNN Models using GPU-based Floating-Point Computing Framework" in MASCOTS 2023. image

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

pre-setup

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

Setup Framework

$ 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 Guideline

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'

torchaxf's People

Contributors

rhkr9609 avatar knuscent avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.