Accelsim(Exec-driven mode)环境搭建和测试(GPGPUSim v4.x)
Accel-Sim (Exec-driven mode)环境搭建和测试,以及iGPGPUSim 4.x的相关运行和测试
相关代码
accel-sim-framework
https://github.com/accel-sim/accel-sim-framework.git 相关说明:
The code for the Accel-Sim and AccelWattch frameworks are in this repo. Accel-Sim 1.0 uses the GPGPU-Sim 4.0 performance model, which was released as part of the original Accel-Sim paper. Building the trace-based Accel-Sim will pull the right version of GPGPU-Sim 4.0 and the AccelWattch power model to use in Accel-Sim. AccelWattch replaces the GPUWattch power model in GPGPU-Sim 4.0.
You do not need to clone the GPGPU-Sim 4.x performance model by yourself. The ./setup_environment.sh will clone the recent GPGPU-Sim model and integrate it with Accel-Sim.
There is an additional repo (GPU App Collection) where we have collected a set of common GPU applications and a common infrastructure for building them with different versions of CUDA. If you use/extend this app framework, it makes Accel-Sim easily usable with a few simple command lines. The instructions in this README will take you through how to use Accel-Sim with the apps in from this collection as well as just on your own, with your own apps.
gpgpu-sim_distribution
上面提到的GPGPU-Sim 4.x performance model
,https://github.com/accel-sim/gpgpu-sim_distribution.git 相关说明:
GPGPU-Sim 4.x In the new version of GPGPU-Sim 4.x, we make extensive modifications to GPGPU-Sim 3.x’s performance model in order to accurately model contemporary and future GPU generations. We designed the new model to be highly flexible and not tuned to a specific architecture.
gpu-app-collection
https://github.com/accel-sim/gpu-app-collection 相关说明:
This repository contains a collection of the most common applications run in simulation. We continuously update this repo over time as different apps become more important. One of the primary goals of this repo is to provide a centralized place for apps that continue to build with different versions of CUDA. Many of the open-source repos for these applications, do not update the build infrastructure such that they build with modern CUDA, while still proving a way to build them with older versions (which may be useful for some apps). The apps in this repo can be built with CUDA 4.2 through 11.0
Accelsim
Accel-Sim Components
1 Accel-Sim Tracer: An NVBit tool for generating SASS traces from CUDA applications. Code for the tool lives in ./util/tracer_nvbit/.
2 Accel-Sim SASS Frontend and Simulation Engine: A simulator frontend that consumes SASS traces and feeds them into a performance model. The intial release of Accel-Sim coincides with the release of GPGPU-Sim 4.0, which acts as the detailed performance model.
3 Accel-Sim Correlator: A tool that matches, plots and correlates statistics from the performance model with real hardware statistics generated by profiling tools. To use the correlator, you must first generate hardware output and simulation statistics. To generate output from the GPU, use the scripts in ./util/hw_stats.
4 Accel-Sim Tuner: An automated tuner that automates configuration file generation from a detailed microbenchmark suite. You need to provide a C header file hw_def that contains minimal information about the hardware model. This file is used to configure and tune the microbenchmarks for the unduerline hardware.
我们后面只关注 GPGPU-Sim PTX emulation 和GPGPU-Sim Perf Model, 即黑色框的相关部分。
上面具体组件在accelsim trace-drven mode下的运行和使用情况可以参考博客 Accel-Sim模拟器 编译、安装与运行
后面的运行环境是基于PTX (vISA)在Exec-driven mode
进行测试和运行分析。不需要真实的GPU硬件环境(mISA trace-driven mode
运行的条件,也可以下载官方提供的trace
),其中trace-dirven mode
的simulation rate
会比exec-driven mode
的高。
GPGPUSim 4.x
后面运行运行测试的平台和需要下面的相关代码:ubuntu20, gcc 9, g++ 9, cuda11; gpgpusim 4.x
源码(accel-sim/gpgpu-sim_distribution);Rodinia
基准程序;Rodinia
的workloads修改后的Makefile
文件。
##install source codes and related benchmarks
wget http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run
git clone https://github.com/accel-sim/gpgpu-sim_distribution && mv gpgpu-sim_distribution gpgpusim-v4
wget http://filedn.com/luEeJVCCazShDlU4ibloXvu/class/rodinia.tar.bz2
//wget -O rodinia.tar.bz2 http://www.cs.virginia.edu/~kw5na/lava/Rodinia/Packages/Current/rodinia_3.1.tar.bz2
## 下载Rodinia修改后的的makefile: https://download.csdn.net/download/Wang121201/89493888
之后的文件结构如下:
~/ : work space
|—gpgpusim-v4:GPGPUSim 4.x源码
|—cuda_11.0.2_450.51.05_linux.run: cudatoolkit
|—rodinia.tar.bz2: Rodinia基准程序
|—makefiles.tar.gz: rodinia修改后的makefile
## install cuda 11
sh cuda_11.0.2_450.51.05_linux.run
## accept, and don't choose driver option, then install
## add cuda path to ~/.bashrc
echo 'export PATH=$PATH:/usr/local/cuda/bin' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib:/usr/local/cuda/lib64' >> ~/.bashrc
echo 'export CUDA_INSTALL_PATH=/usr/local/cuda' >> ~/.bashrc
source ~/.bashrc
nvcc -V
#nvcc: NVIDIA (R) Cuda compiler driver
#Cuda compilation tools, release 11.0, V11.0.194
## install dependencies
sudo apt-get install -y wget build-essential xutils-dev bison zlib1g-dev flex \
libglu1-mesa-dev git g++ libssl-dev libxml2-dev libboost-all-dev git g++ \
libxml2-dev vim python-setuptools python-dev build-essential python3-pip
# GPGPU-Sim dependencies:
apt-get install build-essential xutils-dev bison zlib1g-dev flex libglu1-mesa-dev
#GPGPU-Sim documentation dependencies:
apt-get install doxygen graphviz
# AerialVision dependencies:
apt-get install python-pmw python-ply python-numpy libpng12-dev python-matplotlib
# CUDA SDK dependencies:
apt-get install libxi-dev libxmu-dev libglut3-dev libglu-dev
### gpgpusim 4.x code
cd gpgpusim-v4
source setup_environment && make -j64
### rodinia 3.1
tar -xvjf rodinia.tar.bz2
cd rodinia_3.1/ && vim patch_rodinia.sh
patch_rodinia.sh
的代码如下:
#!/bin/bash
tar -zxvf ../makefiles.tar.gz
if [ -e Makefile ]; then
mv Makefile Makefile.old
fi
cp ./makefiles/Makefile ./
MAKEFILES=$(ls ./makefiles)
for makef in ${MAKEFILES[*]}; do
namef=$(echo "$makef" | sed 's/\./\//g')
cp ./makefiles/$makef ./cuda/$namef
echo "$namef"
done
# add CUDA_SAMPLES_PATH
echo "" >> common/make.config
echo "SDK_DIR = /usr/local/cuda/samples/" >> common/make.config
然后执行脚本,编译Rodinia基准程序,可以设置编译的SM,(cuda11好像支持SM60,SM70,SM75,SM80等),并进行测试
bash patch_rodinia.sh
make -j 64 SM=60
cd bin/linux/cuda
cp ~/gpgpusim-v4/configs/tested-cfgs/SM6_TITANX/* ./
source ~/gpgpusim-v4/setup_environment
ldd backprop
./backprop 1024
Before we run, we need to make sure the application’s executable file is dynamically linked to CUDA runtime library. This can be done during compilation of your program by introducing the nvcc flag “-lcudart” in makefile (quotes should be excluded).
To confirm the same, type the follwoing command:
ldd <your_application_name>
You should see that your application is using libcudart.so file in GPGPUSim directory.
Accel-sim(Exec-driven mode)
这部分在运行时使用accelsim
的框架,包含一些运行时的工具以及脚本,和论文中关联的基准程序,以及accelwattch
功耗模型
However, we encourage you to use our workload launch manager ‘run_simulations’ script as shown above, which will greatly simplify the simulation process and increase productivity.
git clone https://github.com/accel-sim/accel-sim-framework.git
cd accel-sim-framework.git
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
source ./gpu-simulator/setup_environment.sh
make -j -C ./gpu-simulator/
## This will produce an executable in:
## ./gpu-simulator/bin/release/accel-sim.out
## benchmarks collection
cd -
git clone https://github.com/accel-sim/gpu-app-collection.git
source ./gpu-app-collection/src/setup_environment
make -j -C ./gpu-app-collection/src rodinia_2.0-ft
./util/job_launching/run_simulations.py -B rodinia_2.0-ft -C QV100-PTX -N myTest-PTX
##PTX mode usage:
##./util/job_launching/run_simulations.py -B <benchmark> -C <gpu_config> -N <run_identifier>
#Optional:
#[-B benchmark] (From the gpu-app-collection compiled in Step 1)
#[-C gpu_config] (List of supported configs: accel-sim-framework/util/job_launching/configs/define-standard-cfgs.yml)
##You can monitor the tests using:
./util/job_launching/monitor_func_test.py -v -N myTest-PTX
##After the jobs finish - you can collect all the stats using:
./util/job_launching/get_stats.py -N myTest-PTX | tee stats.csv
## Running AccelWattch PTX SIM:
## To run the simple example from bullet 1 with AccelWattch power estimations enabled using the AccelWattch PTX SIM model,
./util/job_launching/run_simulations.py -B rodinia_2.0-ft -C QV100-Accelwattch_PTX_SIM -N test-power
其他基准程序都可以直接编译,然后相关的数据集需要统一下载一个压缩包all.gpgpu-sim-app-data.tgz
,可以查看gpu-app-collection
下的get_data.sh
。
gpu-app-collection
The repo itself has no data (since git is bad with big files). git-lfs is one option that could be explored, but since the public, free version of github limits the capacity and bandwidth using git-lfs, the data is simply retrieved via wget form a tarball hosted on our University servers../get_data.sh
will grab this data, as well as:make data
总结
上面主要是简单梳理了一下gpgpusim 4.x
和Accelsim
的结构和运行测试。参考主要来自对应的代码仓和论文,大部分都是直接引用了相关描述来减少或者避免自己总结分析后的描述可能会产生的偏差。对于上面结构的分析还是比较浅,也有一些模糊的地方,尽量抽取并全面总结了个人认为相关的部分。以上内容仅供参考,后面如果有了新的了解和认识在来更新吧。
更多推荐
所有评论(0)