首页 > 代码库 > 配置gem5-gpu模拟环境

配置gem5-gpu模拟环境

sudo apt-get install nvidia-304

sudo apt-get install nvidia-304-dev

sudo apt-get install nvidia-settings

sudo apt-get install nvidia-current

sudo add-apt-repository ppa:xorg-edgers/ppa

sudo apt-get update

sudo apt-get install libxext-dev libxi-dev x11proto-xext-dev libice-dev libsm-dev libxt-dev libxmu-headers libxmu-dev freeglut3-dev libcr-dev libX11-dev libglu1-mesa

//Install all of gem5s dependencies
sudo apt-get update -y
sudo apt-get install -y         build-essential         python-dev         scons         swig         zlib1g-dev         m4         libprotobuf-dev         python-protobuf         protobuf-compiler         libgoogle-perftools-dev

sudo apt-get install --no-install-recommends -y mercurial

# Install dependencies for gem5-gpu (CUDA benchmarks)
sudo apt-get install -y             gcc-4.6             g++-4.6             python             wget     gcc-4.4     g++-4.4     gcc-4.8     g++-4.8

# if your system is ubuntu 12.04, to install gcc-4.8 is difficult
//REF: http://blog.csdn.net/dezhihuang/article/details/53432465
//REF: http://highlightz.blog.163.com/blog/static/23801000420141115103727888
sudo add-apt-repository ppa:ubuntu-sdk-team/ppa
sudo add-apt-repository ppa:ubuntu-toolchain-r/test

#setup gcc & g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40
sudo update-alternatives --config g++
sudo update-alternatives --config gcc

# Obtaining CUDA Toolkit and CUDA SDK
wget http://developer.download.nvidia.com/compute/cuda/3_2_prod/toolkit/cudatoolkit_3.2.16_linux_64_ubuntu10.04.run
wget http://developer.download.nvidia.com/compute/cuda/3_2_prod/sdk/gpucomputingsdk_3.2.16_linux.run

# Note: May need to make sure return is pressed
sudo bash cudatoolkit_3.2.16_linux_64_ubuntu10.04.run
# Note: must input /usr/local/cuda, then return
bash gpucomputingsdk_3.2.16_linux.run
#sudo mv ~/NVIDIA_GPU_Computing_SDK/C /usr/local/cuda

#edit ~/.bashrc
export CUDAHOME=/usr/local/cuda;
export PATH=$PATH:/usr/local/cuda/bin;
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/lib;
export LIBRARY_PATH=$LIBRARY_PATH:/home/chen/NVIDIA_GPU_Computing_SDK/C/lib;
export NVIDIA_CUDA_SDK_LOCATION=/home/chen/NVIDIA_GPU_Computing_SDK;

#WORKDIR /home/chen/NVIDIA_GPU_Computing_SDK/C/common
make

#WORKDIR /home/chen/NVIDIA_GPU_Computing_SDK/C
make

#Clone gem5 and gem5-patches
hg qclone http://repo.gem5.org/gem5 -p http://gem5-gpu.cs.wisc.edu/repo/gem5-patches
cd gem5/
hg update -r 11061 #2166 files updated, 0 files merged, 1285 files removed, 0 files unresolved
hg qpush -a
cd ../

#Clone GPGPU-Sim and GPGPU-Sim patches (2 separate options)
hg qclone http://gem5-gpu.cs.wisc.edu/repo/gpgpu-sim -p http://gem5-gpu.cs.wisc.edu/repo/gpgpu-sim-patches
cd gpgpu-sim
hg qpush -a
cd ../

#Clone gem5-gpu glue code
hg clone http://gem5-gpu.cs.wisc.edu/repo/gem5-gpu

#Build, GCC 4.8 is used
cd gem5
scons build/X86_VI_hammer_GPU/gem5.opt --default=X86 EXTRAS=../gem5-gpu/src:../gpgpu-sim/ PROTOCOL=VI_hammer GPGPU_SIM=True

#Obtaining Benchmarks,make sure dir benchmarks be located in gem5-gpu
cd gem5-gpu
hg clone https://gem5-gpu.cs.wisc.edu/repo/benchmarks/

#Compile libcuda,GCC 4.4 is used
[gem5-gpu/benchmarks] cd libcuda
[gem5-gpu/benchmarks/libcuda] make
#Example of Compiling a Benchmark
[gem5-gpu/benchmarks] cd rodinia/backprop
[gem5-gpu/benchmarks/rodinia/backprop] make gem5-fusion

#Example of Running a Benchmark
build/X86_VI_hammer_GPU/gem5.opt ../gem5-gpu/configs/se_fusion.py -c ../benchmarks/rodinia/backprop/gem5_fusion_backprop -o 16

 

配置gem5-gpu模拟环境