gem5中stats.txt的统计结果simulation statistics解释说明(运行parsec2.1测试集)

本文解析了PARSEC测试集中不同配置下stats.txt文件中Begin/Endregion统计数据的含义。介绍了有无checkpoint运行的区别,并解释了各部分统计结果所对应的模拟阶段。

参考:http://www.cs.utexas.edu/~parsec_m5/TR-09-32.pdf (parsec测试集的使用文档,主要关注checkpoints)

http://article.gmane.org/gmane.comp.emulators.m5.users/14947/match=begin+simulation(mailing list中的说明)


问题描述:parsec2.1测试集,使用blackscholes_16c_simsmall.rcS脚本运行时,在stats.txt中有一个Begin/End region;使用blackscholes_16c_simsmall_ckpts.rcS的without Checkpoints运行时,在stats.txt中有四个Begin/End region;使用blackscholes_16c_simsmall_ckpts.rcS的with Checkpoints运行时(即先运行命令,生成checkpoints,接着在用--checkpoint-restore=1运行命令,见分析用法),在stats.txt中有两个Begin/End region,那么哪些结果是我们关心的呢?它们分别代表什么含义?


解析:Based on your run script above, you should see 4 separate sets of statistics at the end of simulationcorresponding to: (1) the start of simulation until the dump in the runscript (above), (2) the beginning of the benchmark up to the beginning of the ROI in the benchmark, (3) the benchmark ROI, and (4) from the end of the ROI to when thesimulation exits on '/sbin/m5 exit' (above).  If you are interested in the number of instructions leading up to the ROI, you'll be interested in the stats from the first two stats segments.

这段文字描述了stats.txt中各个部分统计结果的含义,当运行有四部分结果时,第一部分表示模拟刚开始时的统计;第二部分表示benchmark到ROI之间运行的结果;第三部分表示ROI运行的结果;第四部分表示运行完ROI后的结果。

当有两个结果时,第一个结果是ROI运行的结果,第二个是运行完ROI后的结果,因为这部分的是从checkpoints开始运行的;

当有一个结果时,它对应的是第一部分结果即模拟刚开始时的统计;


有和没有checkpoints的用法示例:

有checkpoints时,需要两步,先生成checkpoints,接着在--checkpoint-restore直接运行关心的部分

./build/ALPHA_FS/m5.opt ./configs/example/fs.py -n $numProcs --script=./path/to/runscript.rcS

> ./build/ALPHA_FS/m5.opt ./configs/example/fs.py --detailed --caches --l2cache --checkpoint-restore=1 -n $numProcs


不通过checkpoints运行时,则直接运行

> ./build/ALPHA_FS/m5.opt ./configs/example/fs.py -n $numProcs --script=./path/to/runscript.rcS --detailed --caches --l2cache -F 5000000000

gem5 模拟器的系统调用仿真(SE)模式下,确实支持多核运行 PARSEC 基准测试。SE 模式允许用户运行单一线程或进程的应用程序,同时通过简化操作系统调用的仿真来提高模拟速度。对于多核支持,gem5 提供了多种 CPU 类型和配置选项,可以用来构建多核系统模型[^1]。 ### 多核配置与 PARSEC 基准测试 为了在 SE 模式下运行多线程或多核的 PARSEC 基准测试,需要确保以下几点: 1. **CPU 类型选择**:使用支持多线程或多核的 CPU 类型,例如 `DerivO3CPU` 或 `MinorCPU`。这些 CPU 类型能够更好地模拟现代处理器的行为,支持多线程执行。 2. **系统配置**:在配置 gem5 的 Python 脚本中,需要创建多个 CPU 实例,并将它们连接到共享的内存子系统。这通常涉及设置多个 CPU 和一个共享的 L2 缓存或内存控制器。 3. **基准测试编译**:确保 PARSEC 基准测试被编译为多线程版本。PARSEC 套件中的许多基准测试支持 OpenMP 或 Pthreads,可以通过编译选项启用多线程支持。 4. **运行参数**:在运行 gem5 时,通过命令行参数指定使用的 CPU 类型、核心数量以及其他相关配置。例如,使用 `--num-cpu` 参数指定核心数量。 以下是一个简单的 gem5 配置示例,展示如何在 SE 模式下配置多核系统以运行 PARSEC 基准测试: ```python from m5.objects import * # 创建系统 system = System() system.clk_domain = SrcClockDomain(clock='1GHz', voltage_domain=VoltageDomain()) system.mem_mode = 'timing' system.mem_ranges = [AddrRange('512MB')] # 创建多核 CPU system.cpu = [DerivO3CPU(cpu_id=i) for i in range(4)] # 创建 4 个 O3 CPU 核心 # 创建内存控制器 system.membus = SystemXBar() system.mem_ctrl = DDR3_1600_8x8() system.mem_ctrl.range = system.mem_ranges[0] system.mem_ctrl.port = system.membus.master # 连接 CPU 到内存总线 for cpu in system.cpu: cpu.icache_port = system.membus.slave cpu.dcache_port = system.membus.slave # 创建中断控制器 for cpu in system.cpu: if m5.defines.buildEnv['TARGET_ISA'] == 'x86': cpu.interrupts = [X86LocalApicIntCtrl()] cpu.createInterruptController() # 设置工作负载 binary = '/path/to/parsec/benchmark' system.workload = SEWorkload.init_compatible(binary) # 创建进程 process = Process() process.cmd = [binary] for cpu in system.cpu: cpu.workload = process cpu.createThreads() # 创建系统并运行 root = Root(full_system=False, system=system) m5.instantiate() print("Beginning simulation!") exit_event = m5.simulate() print('Exiting @ tick %i because %s' % (m5.curTick(), exit_event.getCause())) ``` ### 注意事项 - **性能开销**:SE 模式虽然简化了操作系统调用的仿真,但多核系统的模拟仍然会带来较高的性能开销,尤其是在复杂的 CPU 类型(如 `DerivO3CPU`)下。 - **线程调度**:由于 gem5 是一个指令级模拟器,线程调度和同步行为可能与真实硬件有所不同,因此在分析多线程性能时需要注意这一点。 通过上述配置,可以在 gem5 的 SE 模式下成功运行多核的 PARSEC 基准测试,从而评估多核系统的性能[^1]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值