【问题标题】:Why running memtest.py on gem5 gives error with --cpu-type arguments?为什么在 gem5 上运行 memtest.py 会出现 --cpu-type 参数错误?
【发布时间】:2018-09-17 10:06:38
【问题描述】:

memtest.py 以这种方式工作正常:

     build/X86/gem5.opt configs/example/memtest.py 

但是当我给出参数时,它没有给出这样的选项错误:

build/X86/gem5.opt configs/example/memtest.py --cpu-type=TimingSimpleCPU
gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 compiled Jul 27 2018 14:19:35
gem5 started Sep 17 2018 15:31:03
gem5 executing on 2030044470, pid 5045
command line: build/X86/gem5.opt configs/example/memtest.py --cpu-type=TimingSimpleCPU

Usage: memtest.py [options]

memtest.py: error: no such option: --cpu-type

另一方面,se.py 和 fs.py 可以很好地使用附加参数:

build/X86/gem5.opt configs/example/se.py -c /home/prakhar/gem5/tests/test-progs/hello/bin/x86/linux/hello --cpu-type=TimingSimpleCPU 

有没有办法使用 --cpu-type 和 --mem-type 参数运行 memtest.py?

【问题讨论】:

    标签: simulator gem5


    【解决方案1】:

    正如错误提示,没有这样的选项。

    在调用时为 se.py 和 fs.py 添加了 cpu 类型

    Options.addCommonOptions(parser)
    

    您可以手动添加 cpu-type 和 mem-type,方法如下:

    from m5.util import addToPath, fatal
    addToPath('../')
    from common import CpuConfig
    from common import MemConfig
    

    并将选项添加到解析器

    parser = optparse.OptionParser()
    
    # Other parser options
    
    parser.add_option("--cpu-type", type="choice", default="AtomicSimpleCPU",
                      choices=CpuConfig.cpu_names(),
                      help = "type of cpu to run with")
    parser.add_option("--mem-type", type="choice", default="DDR3_1600_8x8",
                      choices=MemConfig.mem_names(),
                      help = "type of memory to use")
    

    然后将选项添加为 options.cpu_typeoptions.mem_type。您可以查看其他示例(在 configs/example/ 中)以了解是否需要修改其他内容以符合您的意图。

    【讨论】:

    • 这只会在输入选项中添加--cpu-type,但实际上我想用不同的cpu-types和内存类型运行memtest.py。例如:--cpu-type=TimingSimpleCPU --mem-type=DRAMSim2.
    • 然后对 mem-type 执行相同的操作(检查 Options.py 中的函数 addNoISAOptions 并导入 MemConfig)。如果您需要许多常用选项,只需添加调用(即 Options.addCommonOptions(parser))。同样,只需检查其他示例,您就会知道该怎么做。
    【解决方案2】:

    好吧,我一直在努力解决这个问题,然后我在 gem5/configs/example/memtest.py 中找到了这一行:

    system = System(physmem = SimpleMemory(),cache_line_size = block_size)
    

    如果您想使用任何其他内存运行,即。 DRAMSim2 你可以改这条线。

    system = System(physmem = DRAMSim2(),cache_line_size = block_size)
    

    这将启用内存类型为 DRAMSim2 的 memtest.py。您现在可以这样:

    build/X86/gem5.opt configs/example/memtest.py
    

    另外改变cpu-type ypu可以参考几行:

    if options.atomic:
        root.system.mem_mode = 'atomic'
    else:
        root.system.mem_mode = 'timing'
    

    默认cpu-type是定时,你可以通过在命令中添加--atomic将其更改为原子。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多