gem5-gpu全系统模式

# 注意:安装好gem5-gpu后再配置全系统环境

# 下载全系统模拟需要的工具,详见http://gem5.org/Running_gem5#Full_System_.28FS.29_Mode,将Linux image放在binaries目录,disk image放在disks目录
# 跳过此步,因为下面俩个链接提供的Full System Files旧,会出现kernel too old、NR_CPUS limit 1 reached 错误信息: 
http://www.m5sim.org/dist/current/x86/x86-system.tar.bz2
# Config files : 
http://www.m5sim.org/dist/current/x86/config-x86.tar.bz2

# 较新的Linux kernel image和disk(parsec):
http://www.cs.utexas.edu/~parsec_m5/x86_64-vmlinux-2.6.28.4-smp
http://www.cs.utexas.edu/~parsec_m5/x86root-parsec.img.bz2

# 目录结构为:
# -x86-system
#   -binaries
#   -configs
#   -disks
# 修改gem-gpu/gem5/configs/common/SysPath.py,修改存放disk和image的目录: path = [ '/dist/m5/system', '~/x86-system' ] # 修改gem5-gpu/gem5/configs/common/Benchmarks.py,X86对应的代码: return env.get('LINUX_IMAGE', disk('x86root-parsec.img')) # 修改gem5-gpu/gem5/configs/common/FSConfig.py中的makeLinuxX86System方法 self.kernel = binary('x86_64-vmlinux-2.6.28.4-smp') # 下载linux-bigswap2.img ,放在x86-system/disks中 http://www.m5sim.org/dist/current/m5_system_2.0b3.tar.bz2 # 修改gem5/src/arch/X86/cpuid.cc,解决kernel bug、kernel panic问题,将后面的两个参数改成 0xe7dbfbff, 0x00000209); # kernel BUG at arch/x86/kernel/xsave.c:323! # Kernel panic - not syncing: Attempted to kill the idle task! # Ref:https://groups.google.com/d/msg/gem5-gpu-dev/2ATuMoTPRTE/JJihLqzPCwAJ result = CpuidResult(0x00020f51, 0x00000805,0xe7dbfbff, 0x04000209);
# 注释gem5-gpu/gem5-gpu/configs/fs_fusion.py中的m5.disableAllListeners(),启动监听端口

# 此项改动可选 # 修改gem5
/src/mem/packet_queue.cc,解决Packet queue %s has grown beyond 100 packets if (transmitList.size() > 1000)
# 编译gem5-gpu,如果仅修改了Python脚本,则无需重新编译;重新编译时,有时会出现build目录下缺少文件,将build目录下的文件删除后再编译! # WORKDIR gem5-gpu/gem5 cd gem5 scons -j 3 build/X86_VI_hammer_GPU/gem5.opt --default=X86 EXTRAS=../gem5-gpu/src:../gpgpu-sim/ PROTOCOL=VI_hammer GPGPU_SIM=True # 此步可选,编辑gem5-gpu/configs/fs_fusion.py,注释m5.disableAllListeners(),在Instantiate system前设置CPU核心数,设4 options.num_cpus = 4 # 运行模拟器,未指定 workload,启动虚拟Linux后,进入bash shell build/X86_VI_hammer_GPU/gem5.opt ../gem5-gpu/configs/fs_fusion.py # 打开另一个终端, 连接至虚拟终端,在终端中执行bash命令、运行benchmark。详见http://gem5.org/Running_gem5#Full_System_.28FS.29_Mode telnet localhost 3456
# 若要启动全系统模式完成后立即执行特定workload,需要启动gem5时使用“--script”选项
# 设rcS脚本为 backprop.rcS,内容为:
cd /rodinia/backprop
/sbin/m5 resetstats
./backprop_fusion [options?]
/sbin/m5 exit

# 要执行backprop_fusion,需要将可执行文件复制到disk中,路径如rcS文件中的一样
# 挂载镜像到/mnt目录,offset=起点 X sectorSize
sudo mount -o loop,offset=32256 x86root-parsec.img /mnt
# 复制benchmark到镜像中,并卸载镜像 sudo cp -r rodinia/backprop /mnt sudo umount /mnt

# 运行backprop.rcS
build/X86_VI_hammer_GPU/gem5.opt gem5-gpu_home/gem5-gpu/configs/fs_fusion.py --script=/path/to/your/rcS_File/backprop.rcS

# ——____———完———————————___—————__————————====———完_______________------______________=___________________--_完___-----





# 小插曲。
#运行某些程序时会出现DEADLOCK,可以修改deadlock_threshold,需要注意的是gem5-gpu/configs/gpu_protocol目录和gpgpu-sim/gpgpu-sim/gpu-sim.cc
# 查看磁盘镜像信息; fdisk
-lu x86root-parsec.img # ls /mnt可以查看到镜像中的文件 # df -h查看磁盘镜像的可用容量,如果不够放benchmark,则需要扩充容量 http://zebinj.blog.163.com/blog/static/206290199201412114912137 http://www.somethingsomewhere.net/resize2fs-bad-magic-number-in-super-block

  # rcS cd命令无法进入benchmark所在目录。可能需要将benchmark复制到镜像后,再改变镜像中目录的权限(a+wr),即可进入。 

# 令我费解的是:将全新的镜像放入disk目录,rcS中的ls命令居然有chai-cuda-u-sim目录removing ptxinfo 很慢~~~?

# 运行chai-cuda-u-sim,serial8250: too much work for irq4

# Ref:https://groups.google.com/d/msg/gem5-gpu-dev/CSEH38SXKh8/_EGIaDw8COwJ

Pass the command line parameter --access-host-pagetable (or something like that).

原文地址:https://www.cnblogs.com/chenhuanBlogs/p/6952510.html