參考《Configure and run parsec 2.1 benchmark in gem5》
PARSEC Benchmark需要在GEM5中的全系統(full system)模式下運行,本篇介紹如何在GEM5模擬器中配置和運行PARSEC Benchmark (以x86架構方式爲例),如果需要在其他架構下運行,需要下載對應的鏡像等文件,具體參考PARSEC官網。
-
首先新建一個文件夾用於存儲PARSEC Benchmark的disk image
mkdir parsec_full_system_images cd parsec_full_system_images
-
下載初始的系統文件,並解壓,再重命名文件夾(重命名可選)
wget http://www.m5sim.org/dist/current/m5_system_2.0b3.tar.bz2 tar jxvf m5_system_2.0b3.tar.bz2 mv m5_system_2.0b3 system
解壓後,文件的目錄結構如下:
system/ binaries/ console ts_osfpal vmlinux disks/ linux-bigswap2.img linux-latest.img
-
下載PARSEC Benchmark相關文件,並替換掉system文件夾中的相應文件
下載PARSEC對應的linux kernel文件,並替換掉 ‘system/binaries/vmlinux’
cd ./system/binaries/ wget http://www.cs.utexas.edu/~parsec_m5/x86_64-vmlinux-2.6.28.4-smp rm vmlinux mv vmlinux_2.6.27-gcc_4.3.4 vmlinux
下載PARSEC-2.1 Disk Image並解壓
cd ../disks/ wget http://www.cs.utexas.edu/~parsec_m5/x86root-parsec.img.bz2 bzip2 -d x86root-parsec.img.bz2
-
進入gem5文件夾,修改三個文件(SysPaths.py 、 Benckmarks.py和FSConfig.py)配置parsec的路徑和文件名
打開SysPaths.py配置parsec disk image的完整路徑:
vim ./configs/common/SysPaths.py
修改前(49行):
path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ]
修改後:
path = [ '/dist/m5/system', '/home/parsec_full_system_images/system' ]
打開Benchmarks.py修改image文件名:
vim ./configs/common/Benchmarks.py
修改前(62行):
elif buildEnv['TARGET_ISA'] == 'x86': return env.get('LINUX_IMAGE', disk('x86root.img'))
修改後:
elif buildEnv['TARGET_ISA'] == 'x86': return env.get('LINUX_IMAGE', disk('linux-parsec-2-1-m5-with-test-inputs.img'))
打開FSConfig.py修改image文件名(第127,563,681行):
vim ./configs/common/FSConfig.py
修改前(127行):
self.disk2.childImage(disk('linux-bigswap2.img'))
修改後:
self.disk2.childImage(disk('x86root-parsec.img))
修改前(563行):
disk2.childImage(disk('linux-bigswap2.img'))
修改後:
disk2.childImage(disk('x86root-parsec.img'))
修改前(681行):
self.kernel = binary('x86_64-vmlinux-2.6.22.9')
修改後:
self.kernel = binary('vmlinux')
-
生成benchmark的script文件,用於運行benchmark
下載PARSEC script生成包,並解壓:
wget http://www.cs.utexas.edu/~parsec_m5/TR-09-32-parsec-2.1-alpha-files.tar.gz tar zxvf TR-09-32-parsec-2.1-alpha-files.tar.gz
生成script命令:
./writescripts.pl <benchmark> <nthreads>
有以下13種benchmark:
blackscholes bodytrack canneal dedup facesim ferret fluidanimate freqmine streamcluster swaptions vips x264 rtview
perl可能會報警告,可以不用管
-
根據生成的script文件運行gem5:
./build/X86/gem5.opt ./configs/example/fs.py -n <number> --script=./path/to/runScript.rcS --caches --l2cache -F 5000000000
其中-n 是線程數,也可以不加這個參數。–script部分要換成自己生成的.rcS腳本。
-
新開一個窗口,使用telnet與gem5模擬系統進行交互
telnet localhost 3456