Prakhar Gurawa
Prakhar Gurawa

Reputation: 393

Why running memtest.py on gem5 gives error with --cpu-type arguments?

The memtest.py is working fine this way:

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

But when i am giving with arguments its is giving no such option error:

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

On the other hand se.py and fs.py works fine with additional arguments:

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

Is there any way to run memtest.py with --cpu-type and --mem-type arguments?

Upvotes: 0

Views: 842

Answers (2)

Prakhar Gurawa
Prakhar Gurawa

Reputation: 393

Well i was struggling with this problem and then i found this line in gem5/configs/example/memtest.py:

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

If you want to run with any other memory ie. DRAMSim2 you can change this line.

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

This will enable running memtest.py with memory type as DRAMSim2.You can now this as:

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

Also to change cpu-type ypu can refer to lines:

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

Default cpu-type is timing and you can change it to atomic by adding --atomic in the command.

Upvotes: 0

Daniel Carvalho
Daniel Carvalho

Reputation: 483

As the error informs, there is no such option.

The cpu-type is added for se.py and fs.py on the call to

Options.addCommonOptions(parser)

You can add both cpu-type and mem-type manually, by doing something along the lines of

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

And adding the options to the parser

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")

The options are then added as options.cpu_type and options.mem_type. You can check the other examples (in configs/example/) to know if you will need to modify other things to comply with your intentions.

Upvotes: 1

Related Questions