CrossSim
CrossSim是一个实现神经形态计算的模拟器,用于人工突触器件搭建神经网络实现模式识别等应用。
安装
创建虚拟环境
使用conda虚拟环境conda create -n crosim python=3.10.8
安装完毕后进入虚拟环境,开始配置依赖。
安装依赖
numpy==1.24.3
scipy==1.11.1
IPython==8.8.0
matplotlib==3.7.2
安装TensorFlow-CPU
若使用CPU版本,则直接pip install tensorflow==2.13.0
即可
安装TensorFlow-GPU
Windows下,在WSL-2中安装GPU版本的TensorFlow-2.13.0
先在WSL中安装CUDA和Cudnn
安装CUDA
wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run
sudo sh cuda_11.1.1_455.32.00_linux.run
下载并安装Cudnn
安装tensorflowpip install tensorflow==2.13.0
安装Cupy 12.1.0
安装CrossSim
根据以上过程,配置好依赖后,开始安装CrossSim
将CrossSim仓库git下来git clone https://github.com/sandialabs/cross-sim.git
进入cross-sim文件夹,执行pip install .
安装CrossSim
然后依次执行
git submodule init
git submodule update --progress
安装子模块,需要较长时间下载模型。
下载完毕后,开始推理测试。
cd applications/dnn/inference
python run_inference.py
运行结果如下:
Loading Keras model...
Reading Keras model metadata...
=======================================
mnist sim: 1000 images, start: 0
Model: CNN6_v2
Mapping: BALANCED
Differential cells style: ONE_SIDED
Subtract current in crossbar: True
Weight quantization: 8 bits
Bit slicing off, 7 bits/cell
Digital bias: True
Batchnorm fold: True
Bias quantization off
Max # rows: 1152
Unlimited # cols
Programming error off
Read noise off
ADC off
Activation quantization on, 8 bits
Input bit slicing: False
Parasitics off
On off ratio: infinite
Weight drift off
=======================================
Initializing neural cores
Beginning inference. Truncated test set to 1000 examples
Example 900/1000, accuracy so far = 98.67%, time = 0.1025ss
Total CPU seconds = 1.023
Inference accuracy: 98.700% (987/1000)
测试成功!
标签:教程,git,off,虚拟环境,安装,CrossSim,1000 From: https://blog.csdn.net/m0_46268825/article/details/142981699