GPU version of Spiking-based BCPNN.
- Support of GPU acceleration (CUDA GPU).
- Support of MPI multi-processing acceleration.
- Support of multiple simulation mode, including CPU, GPU and Mix-CPU-GPU.
- Everything is defined by configuration file.
- Framework architecture. Procedures are loaded at run-time according to configuration file.
GSBN can be compiled with or without CUDA. If CUDA is not present, the program can only run in CPU mode. Parallelism can be achieved by both GPU and MPI multi-processing.
To compile GSBN without GPU support, You only need:
- Build tools: g++, cmake, etc.
- Google Protobuf.
- Any MPI program and library: OpenMPI, IntelMPI, etc.
On Ubuntu linux, you can use command below to install all of them.
sudo apt-get install build-essential cmake libprotobuf-dev protobuf-compiler libopenmpi-dev openmpi-bin openmpi-doc
Extra dependency for compiling GSBN with GPU mode is CUDA library. The installation instruction of CUDA can be found on http://docs.nvidia.com/cuda/cuda-installation-guide-linux/.
Extra dependency for provided Python scripts are python-protobuf, python-numpy and python-matplotlib.
On Ubuntu linux, you can use command below to install all of them.
sudo apt-get install python-protobuf python-numpy python-matplotlib
The configuration file of CMake is located in the root directory of this program package, it's called CMakeLists.txt. Modify it properly according to the instruction below:
- Change the line set(COMPILE_MODE_CUDA true) to set(COMPILE_MODE_CUDA false) if you want to compile without CUDA.
- Uncomment line #list(APPEND CMAKE_PREFIX_PATH "") and fill the correct path to protobuf library if your protobuf is not installed in the standard path.
- Uncomment line #set(CUDA_TOOLKIT_ROOT_DIR ) and fill the correct path to CUDA library if your CUDA is not installed in the standard path.
Compile the program using standard CMake compilation process:
- create a work directory inside the root path of this program package. Let's call it build.
mkdir build
cd build
- create Makefile from CMake configuration file.
cmake ..
- compile the program
make
The commands listed below execute based on the work direcotry build.
- Define the network. You can find a predefined netowk which has 10 HCUs with 10 MCUs in each HCU in <program_root>/data/std_test_10.prototxt. There are 3 blocks inside the network defination file: The gen_param which defines the simulation process, the net_param which defines the newtork structure and update policy and the rec_param which defines the logging system.
- Prepare the stimuli. You can use the python script in <program_root>/tools/stimgen/gen_10x10.py to generate a stimuli file. The command is:
python ../tools/stimgen/gen_10x10.py ../data/stimuli_10x10.bin
- Run the simulation. There are 4 parameters for the simulation program: -n specifies the location of network description file, -s specifies the snapshot file, -m specifies the mode (CPU or GPU) and -l forces the program to print logs to STDOUT. The command is:
./gsbn_sim -n ../data/std_test_10.prototxt -m GPU -l
- Check the recorded spikes. There are several procedures which record the state of the program. ProcSpkRec records spikes, ProcSnapshot takes snapshot during cycles which enables snapshot, while ProcCheck automatically checks the correctness of patterns during test phase and prints out the overall memory capacity. You can use the python script to visulize the spikes:
python ../tools/plot/plot_spk.py ../data/snapshot_10/ProcSpkRec/spk_pop_0.csv
The program will crash while saving a very big snapshot file (such as the snapshot for 100x100 network). It's the problem of protobuf library.