├── .gitignore ├── src ├── test1.cu └── test2.cu ├── syn_gpgpu_sim.sh ├── run_each.sh ├── package.py ├── batch_run.sh ├── README.md ├── run.sh └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | bin 3 | sim 4 | out 5 | -------------------------------------------------------------------------------- /src/test1.cu: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define SIZE 128 4 | 5 | __global__ void simple_test(int *arr){ 6 | arr[threadIdx.x] = threadIdx.x; 7 | } 8 | int main(){ 9 | int *arr_h,*arr_d; 10 | arr_h = (int*)malloc(SIZE*sizeof(int)); 11 | cudaMalloc(&arr_d,SIZE*sizeof(int)); 12 | 13 | simple_test<<<1,SIZE>>>(arr_d); 14 | 15 | cudaMemcpy(arr_h,arr_d,SIZE*sizeof(int),cudaMemcpyDeviceToHost); 16 | 17 | for(int i=0;i 2 | #include 3 | #define SIZE 128 4 | 5 | __global__ void simple_test(int *arr){ 6 | arr[threadIdx.x] = SIZE - threadIdx.x; 7 | } 8 | int main(){ 9 | int *arr_h,*arr_d; 10 | arr_h = (int*)malloc(SIZE*sizeof(int)); 11 | cudaMalloc(&arr_d,SIZE*sizeof(int)); 12 | 13 | simple_test<<<1,SIZE>>>(arr_d); 14 | 15 | cudaMemcpy(arr_h,arr_d,SIZE*sizeof(int),cudaMemcpyDeviceToHost); 16 | 17 | for(int i=0;i /dev/null ; [ $? -ne 0 ] 18 | then 19 | echo "fail to find spack" 20 | elif [ ! -d ${GPGPUSIM_DIR} ] 21 | then 22 | echo "GPGPUSIM_DIR" ${GPGPUSIM_DIR} "not exists" 23 | else 24 | [ ! -d ${MIRROR_DIR} ] && mkdir ${MIRROR_DIR} 25 | [ ! -d ${GPGPUSIM_MIRROR_DIR} ] && mkdir ${GPGPUSIM_MIRROR_DIR} 26 | spack mirror add ${MIRROR_NAME} ${MIRROR_DIR} 2>&1 1>&/dev/null 27 | cd ${GPGPUSIM_DIR} && tar -czf ${GPGPUSIM_TARBALL} * 28 | spack uninstall -y ${GPGPUSIM} 29 | spack install ${GPGPUSIM} 30 | cd ${CUR_DIR} 31 | fi 32 | 33 | -------------------------------------------------------------------------------- /run_each.sh: -------------------------------------------------------------------------------- 1 | # build single *.cu program or run bin/${NAME} on GPGPU-Sim at specified config under spack env 2 | # GPGPUSIM : name of GPGPU-Sim on spack 3 | # CONFIG : which config on GPGPU-Sim eg. RTX2060 GTX480 TITANV 4 | # NAME : ${SRC}/${NAME}.cu or ${BIN}/${NAME} 5 | # OUTNAME : part name of GPGPU-Sim generated file 6 | # BIN : dir where binary file lie 7 | # OUT : dir where generated file lie 8 | # SRC : dir where source file lie 9 | # SIM : dir where execute simulating 10 | # IFBUILD : 1 not skip build ; 0 skip build and just use bin/${NAME} 11 | # IFBACKGROUND : 1 background ; 0 foreground 12 | # ARG : arg pass to the program 13 | # ARCH : nvcc -arch=${ARCH} use for build 14 | # CONFIG_SELECT : 0 only build sim env 1 run 2 run rebuild env 15 | 16 | OUTPATH=${CURDIR}/${OUT}/${OUTNAME}_${CONFIG}_${GPGPUSIM}.txt 17 | SIMPATH=${CURDIR}/${SIM}/${OUTNAME}_${CONFIG}_${GPGPUSIM} 18 | EXEPATH=${CURDIR}/${BIN}/${NAME} 19 | 20 | if [ ! -d ${SIMPATH} ] && [ ${CONFIG_SELECT} -eq 1 ] 21 | then # test SIMPATH exists 22 | echo "build sim env first" 23 | else 24 | if [ ${CONFIG_SELECT} -ne 1 ] 25 | then 26 | echo "build sim env" 27 | rm -rf ${SIMPATH} 28 | cp -r $(spack location -i \ 29 | ${GPGPUSIM})/gpgpu-sim_distribution/configs/tested-cfgs/SM*_${CONFIG} ${SIMPATH} 30 | else 31 | echo "use existed sim env" 32 | fi 33 | 34 | export CUDA_INSTALL_PATH=$(spack location -i cuda@${CUDAVERSION}) 35 | . $(spack location -i ${GPGPUSIM})/gpgpu-sim_distribution/setup_environment 2>&1 1>&/dev/null 36 | 37 | if [ ${CONFIG_SELECT} -ne 0 ] 38 | then 39 | echo "execute" ${NAME} ${ARG} "on" ${GPGPUSIM} ${CONFIG} 40 | fi 41 | 42 | if [ ${IFBACKGROUND} -eq 1 ] && [ ${CONFIG_SELECT} -ne 0 ] 43 | then 44 | cd ${SIMPATH} && \ 45 | nohup ${EXEPATH} ${ARG} > ${OUTPATH} 2>&1 & # run at background 46 | elif [ ${CONFIG_SELECT} -ne 0 ] 47 | then 48 | cd ${SIMPATH} && \ 49 | ${EXEPATH} ${ARG} > ${OUTPATH} # run at foreground 50 | fi 51 | cd ${CURDIR} 52 | fi 53 | 54 | -------------------------------------------------------------------------------- /package.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other 2 | # Spack Project Developers. See the top-level COPYRIGHT file for details. 3 | # 4 | # SPDX-License-Identifier: (Apache-2.0 OR MIT) 5 | 6 | from spack import * 7 | import glob 8 | 9 | 10 | class GpgpuSim(MakefilePackage): 11 | 12 | homepage = "https://github.com/gpgpu-sim/gpgpu-sim_distribution" 13 | git = homepage + ".git" 14 | 15 | version('4.0.1',branch='master') 16 | # url = "https://github.com/gpgpu-sim/gpgpu-sim_distribution/archive/refs/tags/v4.0.1.tar.gz" 17 | 18 | # version('4.0.1', tag='v4.0.1') 19 | # version( 20 | # '4.0.1', sha256='9c7d6e42af507dc7d7572cfe0d5179fa41b90bf3299522e438034a1aaad06f81') 21 | 22 | depends_on('makedepend', type=('build')) 23 | depends_on('sed', type=('build')) 24 | depends_on('bison', type=('build')) 25 | depends_on('flex', type=('build')) 26 | depends_on('zlib', type=('link')) 27 | depends_on('cuda', type=('build', 'link', 'run')) 28 | depends_on('gl', type=('link')) 29 | conflicts("%"+"gcc@8:") 30 | 31 | def edit(self, spec, prefix): 32 | # fix 33 | cuda_sim_Makefile = FileFilter('src/cuda-sim/Makefile') 34 | cuda_sim_Makefile.filter( 35 | '> \$\(OUTPUT_DIR\)/ptx_parser_decode\.def', 36 | ' | sed \'s/"end of file"/end of file/\' ' + 37 | ' | sed \'s/"invalid token"/invalid token/\' ' + 38 | '> $(OUTPUT_DIR)/ptx_parser_decode.def') 39 | for mf in ['setup_environment']+glob.glob("**/*akefile", recursive=True)+glob.glob("**/*.mk", recursive=True): 40 | print(mf, flush=True) 41 | m = FileFilter(mf) 42 | m.filter('gcc-\$\(CC_VERSION\)/cuda-\$\(CUDART_VERSION\)/', '') 43 | m.filter('gcc-\$CC_VERSION/cuda-\$CUDA_VERSION_NUMBER/', '') 44 | m.filter('gcc', 'cc') 45 | m.filter('g\+\+', 'c++') 46 | m.filter('CC_VERSION.*', '') 47 | 48 | def install(self, spec, prefix): 49 | mkdirp(join_path(prefix, 'gpgpu-sim_distribution')) 50 | install_tree(self.stage.source_path, join_path( 51 | prefix, 'gpgpu-sim_distribution')) 52 | 53 | def setup_build_environment(self, env): 54 | env.set('CUDA_INSTALL_PATH', self.spec['cuda'].prefix) 55 | env.set('GPGPUSIM_ROOT', self.stage.source_path) 56 | env.set('GPGPUSIM_POWER_MODEL', 57 | self.stage.source_path+'/src/gpuwattch/') 58 | env.set('GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN', '1') 59 | 60 | def setup_run_environment(self, env): 61 | env.set('CUDA_INSTALL_PATH', self.spec['cuda'].prefix) 62 | -------------------------------------------------------------------------------- /batch_run.sh: -------------------------------------------------------------------------------- 1 | NAME_ARR=("test1" "test2") 2 | ARG_ARR=("" "") 3 | GPGPUSIM_ARR=("gpgpu-sim@4.0.1" ) 4 | CONFIG_ARR=("RTX2060" "QV100") 5 | RUNEACH=run_each.sh 6 | 7 | export CUDAVERSION=11.7 8 | export ARCH=sm_70 9 | export IFBUILD=1 10 | export IFBACKGROUND=0 11 | export CONFIG_SELECT=2 12 | export BIN=bin 13 | export OUT=out 14 | export SRC=src 15 | export SIM=sim 16 | export CURDIR=$(pwd) 17 | 18 | [ ! -d ${SRC} ] && mkdir ${SRC} 19 | [ ! -d ${SIM} ] && mkdir ${SIM} 20 | [ ! -d ${BIN} ] && mkdir ${BIN} 21 | [ ! -d ${OUT} ] && mkdir ${OUT} 22 | 23 | if spack load cuda@${CUDAVERSION} > /dev/null ; [ $? -ne 0 ] ; then # test load cuda 24 | echo "fail to load cuda@"${CUDAVERSION} 25 | elif spack -V > /dev/null ; [ $? -ne 0 ] 26 | then 27 | echo "fail to find spack" 28 | elif [ ! ${#NAME_ARR[@]} -eq ${#ARG_ARR[@]} ] ; then 29 | echo "length of NAME and ARG not equal" 30 | elif [ ! -e ${RUNEACH} ] ; then 31 | echo ${RUNEACH} "not exist" 32 | elif [ ${#GPGPUSIM_ARR[@]} -eq 0 ] ; then 33 | echo "please set GPGPUSIM_ARR" 34 | elif [ ${#CONFIG_ARR[@]} -eq 0 ] ; then 35 | echo "please set CONFIG_ARR" 36 | else 37 | # check GPGPU-SIM 38 | for ((i=0;i<${#GPGPUSIM_ARR[@]};i++)) ; do 39 | GPGPUSIM=${GPGPUSIM_ARR[${i}]} 40 | if spack location -i ${GPGPUSIM} > /dev/null ; [ $? -ne 0 ] 41 | then # test GPGPUSIM exist 42 | echo ${GPGPUSIM} "not found" 43 | exit 44 | fi 45 | done 46 | 47 | # check config exist 48 | for ((i=0;i<${#CONFIG_ARR[@]};i++)) ; do 49 | CONFIG=${CONFIG_ARR[${i}]} 50 | for ((j=0;j<${#GPGPUSIM_ARR[@]};j++)) ; do 51 | GPGPUSIM=${GPGPUSIM_ARR[${j}]} 52 | if [ ! -d $(spack location -i ${GPGPUSIM})/gpgpu-sim_distribution/configs/tested-cfgs/SM*_${CONFIG} ] 53 | then # test config exists 54 | echo "config" ${CONFIG} "not exists in" ${GPGPUSIM} 55 | ls $(spack location -i ${GPGPUSIM})/gpgpu-sim_distribution/configs/tested-cfgs 56 | exit 57 | fi 58 | done 59 | done 60 | 61 | # check src or bin 62 | for ((i=0;i<${#NAME_ARR[@]};i++)) ; do 63 | NAME=${NAME_ARR[${i}]} 64 | if [ ! -e ${SRC}/${NAME}.cu ] && [ ${IFBUILD} -eq 1 ] # test *.cu exist 65 | then 66 | echo ${SRC}/${NAME}.cu "not exists" 67 | exit 68 | elif [ ! -e ${BIN}/${NAME} ] && [ ${IFBUILD} -eq 0 ] # test binary exist 69 | then 70 | echo ${BIN}/${NAME} "not exists" 71 | exit 72 | fi 73 | done 74 | 75 | # build single *.cu 76 | if [ ${IFBUILD} -eq 1 ] ; then 77 | for ((i=0;i<${#NAME_ARR[@]};i++)) ; do 78 | NAME=${NAME_ARR[${i}]} 79 | echo "build" ${NAME}.cu 80 | nvcc -arch=${ARCH} --cudart shared ${SRC}/${NAME}.cu -o ${BIN}/${NAME} 81 | if [ ! $? -eq 0 ] ; then 82 | echo "fail to build" ${NAME} 83 | exit 84 | fi 85 | done 86 | fi 87 | 88 | 89 | for ((i=0;i<${#CONFIG_ARR[@]};i++)) ; do 90 | for ((j=0;j<${#GPGPUSIM_ARR[@]};j++)) ; do 91 | for ((k=0;k<${#NAME_ARR[@]};k++)) ; do 92 | echo "--------------" 93 | export CONFIG=${CONFIG_ARR[${i}]} 94 | export GPGPUSIM=${GPGPUSIM_ARR[${j}]} 95 | export NAME=${NAME_ARR[${k}]} 96 | export OUTNAME=${NAME} 97 | export ARG=${ARG_ARR[${k}]} 98 | . ${RUNEACH} 99 | done 100 | done 101 | done 102 | fi 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # [GPGPU-SIM 使用篇](https://github.com/gty111/SimpleUseGpgpuSim) 3 | 4 | ## 什么是GPGPU-SIM 5 | 6 | - 简单地说,GPGPU-SIM是一款仿真器,可以在CPU上仿真执行[CUDA](https://docs.nvidia.cn/cuda/)程序 7 | - [主页](http://www.gpgpu-sim.org/) 8 | - [使用手册](http://gpgpu-sim.org/manual/index.php/Main_Page) 9 | - [github](https://github.com/gpgpu-sim/) 10 | 11 | ## 如何优雅地安装GPGPU-SIM 12 | 13 | > **依赖=>[Spack](https://spack.readthedocs.io/en/latest/)** 14 | 15 | - GPGPU-SIM的手动安装过程较为复杂,很容易因为依赖导致安装失败 16 | - **强烈推荐[通过Spack安装](https://github.com/wu-kan/wu-kan.github.io/blob/a94869ef1f1f6bf5daf9535cacbfc69912c2322b/_posts/2022-01-27-%E6%A8%A1%E6%8B%9F%E5%99%A8%20GPGPU-Sim%20%E7%9A%84%E4%BD%BF%E7%94%A8%E4%BB%8B%E7%BB%8D.md)** 17 | - 这里介绍参考上面的安装方法 18 | 19 | - 在安装好spack后,运行命令```spack create gpgpu-sim ```并修改内容为[package.py](https://github.com/gty111/SimpleUseGpgpuSim/blob/master/package.py) 20 | - 运行命令```spack install gpgpu-sim%gcc@7.5.0 ^ mesa~llvm``` 21 | 22 | 23 | 24 | ## 如何优雅地使用GPGPU-SIM 25 | 26 | > **依赖=>通过spack安装GPGPU-SIM** 27 | 28 | GPGPU-SIM仿真需要在运行目录下存在config文件,且每次运行过后都会有很多其他文件生成,导致文件混乱 29 | 30 | ### 单次仿真 31 | 32 | - 为了解决上述问题,我写了几个脚本来在GPGPU-SIM上仿真程序 33 | 34 | - 例如,你想使用```RTX2060```配置仿真,你的仿真程序为```test.cu```,你的Spack上CUDA版本为```11.7```,你需要通过nvcc编译仿真程序,你的Spack上GPGPU-SIM为```gpgpu-sim@4.0.1```,那么你需要在run.sh中修改变量```NAME=test```、```CONFIG=RTX2060```、```GPGPUSIM=gpgpu-sim@4.0.1```、```IFBUILD=1```,```CUDAVERSION=11.7```,将```test.cu```放到```${SRC}```目录下,并在终端中输入如下命令 35 | 36 | > 或者你也可以将编译好的程序放到```${BIN}```目录下,并修改```IFBUILD=0``` 37 | 38 | ```shell 39 | # pwd 40 | # **/SimpleUseGpgpuSim 确保当前目录在SimpleUseGpgpuSim 41 | bash run.sh 42 | ``` 43 | 44 | - 此时文件(your_dir)目录结构为 45 | 46 | - bin 目录存放编译好或提前放置的可执行程序 47 | - sim 目录存放每次仿真后GPGPU-SIM自动输出的文件和指定的配置文件 48 | - out 目录存放每次仿真后GPGPU-SIM的输出信息 49 | 50 | ``` 51 | |-- run.sh 52 | |-- src 53 | |-- test.cu 54 | |-- bin 55 | |-- test 56 | |-- sim 57 | |-- test_RTX2060_gpgpu-sim@4.0.1 58 | |-- ... 59 | |-- out 60 | |-- test_RTX2060_gpgpu-sim@4.0.1.txt 61 | ``` 62 | 63 | - 变量的使用详见```run.sh```中的注释 64 | 65 | - [run.sh](https://github.com/gty111/SimpleUseGpgpuSim/blob/master/run.sh) 66 | 67 | 68 | ### 批量仿真 69 | 70 | - 批量仿真基于单次仿真 71 | 72 | - 假如你想仿真```test1.cu```和```test2.cu```程序,并希望使用GPGPU-SIM```4.0.1```版本仿真(需要Spack中存在以上版本),仿真配置为```RTX2060```或```QV100```,修改好的变量见```batch_run.sh```,并在终端输入如下命令 73 | 74 | ```shell 75 | # pwd 76 | # **/SimpleUseGpgpuSim 确保当前目录在SimpleUseGpgpuSim 77 | bash batch_run.sh 78 | ``` 79 | 80 | - 得到的文件目录结构和单次仿真一致 81 | 82 | - [batch_run.sh](https://github.com/gty111/SimpleUseGpgpuSim/blob/master/batch_run.sh) 83 | 84 | - [run_each.sh](https://github.com/gty111/SimpleUseGpgpuSim/blob/master/syn_gpgpu_sim.sh) 85 | 86 | ## 如何优雅地构建GPGPU-SIM 87 | > **依赖=>通过spack安装GPGPU-SIM** 88 | 89 | 例如,你修改了GPGPU-SIM的源码,那么怎么通过Spack重新构建GPGPU-SIM? 90 | - 可以通过```syn_gpgpu_sim.sh```完成**一键重新构建** 91 | - 例如,你修改的GPGPU-SIM的路径为```~/gpgpu-sim```,在```syn_gpgpu_sim.sh```修改```GPGPUSIM_DIR=~/gpgpu-sim```,并在终端输入 92 | ```shell 93 | # pwd 94 | # **/SimpleUseGpgpuSim 确保当前目录在SimpleUseGpgpuSim 95 | . syn_gpgpu_sim.sh 96 | ``` 97 | > 注意需要运行命令 ```spack edit gpgpu-sim```并修改为[package.py](https://github.com/gty111/SimpleUseGpgpuSim/blob/master/package.py) 98 | - 变量的使用详见```syn_gpgpu_sim.sh```中的注释 99 | - [syn_gpgpu_sim.sh](https://github.com/gty111/SimpleUseGpgpuSim/blob/master/syn_gpgpu_sim.sh) 100 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | # build single *.cu program or run bin/${NAME} on GPGPU-Sim at specified config under spack env 2 | # GPGPUSIM : name of GPGPU-Sim on spack 3 | # CONFIG : which config on GPGPU-Sim eg. RTX2060 GTX480 TITANV 4 | # NAME : ${SRC}/${NAME}.cu or ${BIN}/${NAME} 5 | # OUTNAME : part name of GPGPU-Sim generated file 6 | # BIN : dir where binary file lie 7 | # OUT : dir where generated file lie 8 | # SRC : dir where source file lie 9 | # SIM : dir where execute simulating 10 | # IFBUILD : 1 not skip build ; 0 skip build and just use bin/${NAME} 11 | # IFBACKGROUND : 1 background ; 0 foreground 12 | # ARG : arg pass to the program 13 | # ARCH : nvcc -arch=${ARCH} use for build 14 | # IFDEBUG : 1 use gdb and source debug in GPGPUSIM; 0 not use gdb 15 | # CONFIG_SELECT : 0 only build sim env 1 run 2 run rebuild env 16 | # IFLINKDATA : 1 link DATADIR ; 0 not link DATADIR 17 | # DATADIR : the data directory when the program runs 18 | 19 | NAME=test1 20 | CONFIG=RTX2060 # ${CONFIG}=help (to see what config gpgpusim has) 21 | GPGPUSIM=gpgpu-sim@4.0.1 22 | CUDAVERSION=11.7 23 | ARCH=sm_70 24 | IFBUILD=1 25 | IFBACKGROUND=0 26 | IFDEBUG=0 27 | CONFIG_SELECT=2 # 0 only build sim env ;1 run ;2 run rebuild env 28 | ARG= 29 | IFLINKDATA=0 30 | DATADIR= 31 | 32 | OUTNAME=${NAME} 33 | 34 | BIN=bin 35 | OUT=out 36 | SRC=src 37 | SIM=sim 38 | 39 | CURDIR=$(pwd) 40 | 41 | OUTPATH=${CURDIR}/${OUT}/${OUTNAME}_${CONFIG}_${GPGPUSIM}.txt 42 | SIMPATH=${CURDIR}/${SIM}/${OUTNAME}_${CONFIG}_${GPGPUSIM} 43 | EXEPATH=${CURDIR}/${BIN}/${NAME} 44 | 45 | [ ! -d ${SRC} ] && mkdir ${SRC} 46 | 47 | if spack -V > /dev/null ; [ $? -ne 0 ] 48 | then 49 | echo "fail to find spack" 50 | elif spack load cuda@${CUDAVERSION} > /dev/null ; [ $? -ne 0 ] 51 | then # test load cuda 52 | echo "fail to load cuda@"${CUDAVERSION} 53 | elif spack location -i ${GPGPUSIM} > /dev/null ; [ $? -ne 0 ] 54 | then # test GPGPUSIM exist 55 | echo ${GPGPUSIM} "not found" 56 | elif [ ! -e ${SRC}/${NAME}.cu ] && [ ${IFBUILD} -eq 1 ] # test *.cu exist 57 | then 58 | echo ${SRC}/${NAME}.cu "not exists" 59 | elif [ ! -e ${BIN}/${NAME} ] && [ ${IFBUILD} -eq 0 ] # test binary exist 60 | then 61 | echo ${BIN}/${NAME} "not exists" 62 | elif [ ! -d $(spack location -i ${GPGPUSIM})/gpgpu-sim_distribution/configs/tested-cfgs/SM*_${CONFIG} ] 63 | then # test config exists 64 | echo "config" ${CONFIG} "not exists" 65 | ls $(spack location -i ${GPGPUSIM})/gpgpu-sim_distribution/configs/tested-cfgs 66 | elif [ ! -d ${SIMPATH} ] && [ ${CONFIG_SELECT} -eq 1 ] 67 | then # test SIMPATH exists 68 | echo "build sim env first" 69 | else 70 | #init dir 71 | [ ! -d ${SIM} ] && mkdir ${SIM} 72 | [ ! -d ${BIN} ] && mkdir ${BIN} 73 | [ ! -d ${OUT} ] && mkdir ${OUT} 74 | 75 | if [ ${CONFIG_SELECT} -ne 1 ] 76 | then 77 | echo "build sim env" 78 | rm -rf ${SIMPATH} 79 | cp -r $(spack location -i \ 80 | ${GPGPUSIM})/gpgpu-sim_distribution/configs/tested-cfgs/SM*_${CONFIG} ${SIMPATH} 81 | else 82 | echo "use existed sim env" 83 | fi 84 | 85 | if [ ${IFBUILD} -eq 1 ] 86 | then 87 | echo "build" ${NAME}.cu 88 | nvcc -arch=${ARCH} --cudart shared ${SRC}/${NAME}.cu -o ${BIN}/${NAME} 89 | else 90 | echo "skip build from source" 91 | fi 92 | 93 | export CUDA_INSTALL_PATH=$(spack location -i cuda@${CUDAVERSION}) 94 | if [ ${IFDEBUG} -eq 0 ]; then 95 | . $(spack location -i ${GPGPUSIM})/gpgpu-sim_distribution/setup_environment 2>&1 1>&/dev/null 96 | else 97 | . $(spack location -i ${GPGPUSIM})/gpgpu-sim_distribution/setup_environment debug 2>&1 1>&/dev/null 98 | fi 99 | 100 | if [ ${IFLINKDATA} -eq 1 ]; then 101 | ln -s ${DATADIR} ${SIMPATH} 102 | fi 103 | 104 | if [ ${CONFIG_SELECT} -ne 0 ] 105 | then 106 | echo "execute" ${NAME} ${ARG} "on" ${GPGPUSIM} ${CONFIG} 107 | fi 108 | 109 | if [ ${IFDEBUG} -eq 1 ] && [ ${CONFIG_SELECT} -ne 0 ] 110 | then 111 | cd ${SIMPATH} && gdb ${EXEPATH} 112 | elif [ ${IFBACKGROUND} -eq 1 ] && [ ${CONFIG_SELECT} -ne 0 ] 113 | then 114 | cd ${SIMPATH} && \ 115 | nohup ${EXEPATH} ${ARG} > ${OUTPATH} 2>&1 & # run at background 116 | elif [ ${CONFIG_SELECT} -ne 0 ] 117 | then 118 | cd ${SIMPATH} && \ 119 | ${EXEPATH} ${ARG} > ${OUTPATH} # run at foreground 120 | fi 121 | cd ${CURDIR} 122 | fi 123 | 124 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------