Sunday, July 7, 2019

CUDA GPU Simulator Container

I was searching for a GPU simulator to experiment with CUDA on my laptop, which has no GPU. GPGPU-Sim [1,2] is a cycle-level GPU performance simulator for general purpose computation on GPU. The procedure for installing GPGPU-Sim seemed a little complicated on my MacBook (macOS). Therefore, I proceeded with using docker on my MacBook running an Ubuntu 18.04 docker image and installed CUDA and GPGPU-Sim in it. The procedure for using the GPU simulator with docker to run CUDA programs is listed below.

Software versions in gpgpu-sim container v0.2:

CUDA version: 10.1
gcc/g++ version: 7.5.0
Files: [Dockerfile] [script.sh]

Software versions in gpgpu-sim container v0.1:

CUDA version: 9.1
gcc/g++ version: 6.5.0

How to run:


  • To run the GPGPU-Sim docker image for the first time (use sudo if permission problems arise):

docker run -w /root -it srirajpaul/gpgpu-sim:0.2 /bin/bash

(This command will download and start the docker image containing the CUDA and GPGPU-Sim)

  • To test whether CUDA is working (within the docker container):

cd test
nvcc --cudart shared vec_add.cu -o vec_add
./vec_add

(Remember that the flag '--cudart shared' is required to load the GPGPU-Sim replacement libraries instead of the actual CUDA ones while executing the CUDA program)

  • To stop and exit from the docker container:

exit

  • To start and run the docker container for the second time onwards:

docker start <container-id>
docker attach <container-id>

(The container-id can be obtained using: 'docker container ls -a' )
  • To run directly from the host system, use the exec command:

docker exec -it <container-id> bash -ic 'cd test;sh run.sh'


Note: Tested the GPGPU-Sim installed docker image on Mac OS X, Ubuntu 16.04 and 18.04

[1] Bakhoda, Ali, George L. Yuan, Wilson WL Fung, Henry Wong, and Tor M. Aamodt. "Analyzing CUDA workloads using a detailed GPU simulator." In IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS), Boston, MA, April 19-21, 2009.

[2] Mahmoud Khairy, Zhesheng Shen, Tor M. Aamodt, Timothy G Rogers. "Accel-Sim: An Extensible Simulation Framework for Validated GPU Modeling." In proceedings of the 47th IEEE/ACM International Symposium on Computer Architecture (ISCA), May 29 - June 3, 2020.

Monday, July 9, 2007

My first Blog