Discussion:
What to do before instantiating gem5?
mehmet basaran
2013-01-04 18:54:03 UTC
Permalink
Hi all,

This is probably a dumn question but what should I do before instantiating
m5? I was going over tutorials, and tried to create a simple simulation
script. The error message I have is;

--------------------------------------------------------------------------------------------------
command line: ./build/X86/gem5.opt --debug-flags=Cache
--trace-file=my_trace.out configs/example/hardcoded.py -c
tests/test-progs/queens/bin/x86/linux/queens -o -c 8 --caches --l2cache
--cpu-type=timing
Global frequency set at 1000000000000 ticks per second
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/matara/Apps/gem5-e71f71ce233a/src/python/m5/main.py", line
359, in main
exec filecode in scope
File "configs/example/hardcoded.py", line 46, in <module>
m5.instantiate()
File "/home/matara/Apps/gem5-e71f71ce233a/src/python/m5/simulate.py",
line 106, in instantiate
for obj in root.descendants(): obj.createCCObject()
File "/home/matara/Apps/gem5-e71f71ce233a/src/python/m5/SimObject.py",
line 1040, in createCCObject
self.getCCObject() # force creation
File "/home/matara/Apps/gem5-e71f71ce233a/src/python/m5/SimObject.py",
line 1025, in getCCObject
self._ccObject = params.create()
AttributeError: 'MemObjectParams' object has no attribute 'create'
--------------------------------------------------------------------------------------------------

I copied my script mostly from Hipeac conference slides in tutorials;

--------------------------------------------------------------------------------------------------
import m5
from m5.objects import *
from m5.params import VectorSlavePort, VectorMasterPort

class L1Cache(BaseCache):
assoc = 2
block_size = 64
mshrs = 10
tgts_per_mshr = 5
is_top_level = True

class L2Cache(BaseCache):
assoc = 8
block_size = 128
mshrs = 10
tgts_per_mshr = 5

class Bus(MemObject):
slave = VectorSlavePort("vector port for connecting masters")
master = VectorMasterPort("vector port for connecting slaves")

cpu = TimingSimpleCPU(cpu_id = 0)
cpu.addTwoLevelCacheHierarchy(L1Cache(size='128kB'),
L1Cache(size='256kB'),
L2Cache(size='2MB'))

system = System(cpu = cpu,
physmem = SimpleMemory(),
membus=Bus())

process = LiveProcess()
process.executable = 'hello'
# root.system.cpu.workload = LiveProcess(cmd = 'hello’, executable =
binpath('hello'))

system.system_port = system.membus.slave
system.physmem.port = system.membus.master

# create the interrupt controller
cpu.createInterruptController()
cpu.connectAllPorts(system.membus)
cpu.clock = '2GHz'

root = Root(full_system=False, system = system)

# instantiate configuration
m5.instantiate()

# simulate until program terminates
exit_event = m5.simulate(m5.MaxTick)
--------------------------------------------------------------------------------------------------

Do you have any pointers?

Thanks for your time.
Mehmet
Nilay Vaish
2013-01-05 01:09:30 UTC
Permalink
Post by mehmet basaran
Hi all,
This is probably a dumn question but what should I do before instantiating
m5? I was going over tutorials, and tried to create a simple simulation
script. The error message I have is;
--------------------------------------------------------------------------------------------------
command line: ./build/X86/gem5.opt --debug-flags=Cache
--trace-file=my_trace.out configs/example/hardcoded.py -c
tests/test-progs/queens/bin/x86/linux/queens -o -c 8 --caches --l2cache
--cpu-type=timing
Global frequency set at 1000000000000 ticks per second
File "<string>", line 1, in <module>
File "/home/matara/Apps/gem5-e71f71ce233a/src/python/m5/main.py", line
359, in main
exec filecode in scope
File "configs/example/hardcoded.py", line 46, in <module>
m5.instantiate()
File "/home/matara/Apps/gem5-e71f71ce233a/src/python/m5/simulate.py",
line 106, in instantiate
for obj in root.descendants(): obj.createCCObject()
File "/home/matara/Apps/gem5-e71f71ce233a/src/python/m5/SimObject.py",
line 1040, in createCCObject
self.getCCObject() # force creation
File "/home/matara/Apps/gem5-e71f71ce233a/src/python/m5/SimObject.py",
line 1025, in getCCObject
self._ccObject = params.create()
AttributeError: 'MemObjectParams' object has no attribute 'create'
--------------------------------------------------------------------------------------------------
I copied my script mostly from Hipeac conference slides in tutorials;
You might want to try out gem5 with scripts from configs/examples/
directory. In particular, check whether se.py works for you or not. You
can read the documentation on gem5.org on how to use these scripts.

--
Nilay
mehmet basaran
2013-01-05 03:49:02 UTC
Permalink
Hi Nilay,

Thanks for your answer. I was able to successfully run queens benchmark by
using se.py under examples. My command was;
-----------------------------------------------------------------------------------------------------
./build/X86/gem5.opt --debug-flags=Cache --trace-file=my_trace.out
configs/example/se.py -c tests/testprogs/queens/bin/x86/linux/queens -o "-c
8" --caches --l2cache \--cpu-type=timing
-----------------------------------------------------------------------------------------------------

Now I have modified common/Options.py and se.py to have 2 processors. I
have manually added 2 processes. In se.py, I have modified benchmarks part
like this;
-----------------------------------------------------------------------------------------------------
if options.benchmark:
workload1 = "tests/test-progs/queens/bin/x86/linux/queens"
workload1_args = "-c 8"
workload2 = "tests/test-progs/hello/bin/x86/linux/hello"

process1 = LiveProcess()
process1.executable = workload1
process1.cmd = [workload1] + workload1_args.split()
process1.output = "m5out/p1.txt"

print "process1.cmd: ", process1.cmd

process2 = LiveProcess()
process2.executable = workload2
process2.cmd = [workload2]
process2.output = "m5out/p2.txt"

multiprocesses.append(process1)
multiprocesses.append(process2)
-----------------------------------------------------------------------------------------------------

When I run 2 queens benchmark with different parameters, it's ok. But when
I run 1 queens and 1 hello as above, I cannot see queens finishing in
output files. But hello does before simulation terminates. Is there
something I am missing?

Console;
-----------------------------------------------------------------------------------------------------
./build/X86/gem5.opt --debug-flags=Cache --trace-file=my_trace.out
configs/example/WithOptionParser.py -b --caches --l2cache \--cpu-type=timing
-----------------------------------------------------------------------------------------------------

In output I normally have only 2 unimplemented instruction warning because
of queens benchmark. But it gives 4 when I run hello and queens together.
Why does this happen ?

Output;
-----------------------------------------------------------------------------------------------------
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 compiled Oct 31 2012 13:42:49
gem5 started Jan 5 2013 05:43:05
gem5 executing on matara-HP-Pavilion-dv6-Notebook-PC
command line: ./build/X86/gem5.opt --debug-flags=Cache
--trace-file=my_trace.out configs/example/WithOptionParser.py -b --caches
--l2cache --cpu-type=timing
process1.cmd: ['tests/test-progs/queens/bin/x86/linux/queens', '-c', '8']
Global frequency set at 1000000000000 ticks per second
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7003
0: system.remote_gdb.listener: listening for remote gdb #1 on port 7004
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
warn: instruction 'fnstcw_Mw' unimplemented
warn: instruction 'fldcw_Mw' unimplemented
warn: instruction 'fnstcw_Mw' unimplemented
warn: instruction 'fldcw_Mw' unimplemented
hack: be nice to actually delete the event here
Exiting @ tick 108416000 because target called exit()
-----------------------------------------------------------------------------------------------------

Thanks in advance
Mehmet
Post by mehmet basaran
Hi all,
Post by mehmet basaran
This is probably a dumn question but what should I do before instantiating
m5? I was going over tutorials, and tried to create a simple simulation
script. The error message I have is;
------------------------------**------------------------------**
------------------------------**--------
command line: ./build/X86/gem5.opt --debug-flags=Cache
--trace-file=my_trace.out configs/example/hardcoded.py -c
tests/test-progs/queens/bin/**x86/linux/queens -o -c 8 --caches --l2cache
--cpu-type=timing
Global frequency set at 1000000000000 ticks per second
File "<string>", line 1, in <module>
File "/home/matara/Apps/gem5-**e71f71ce233a/src/python/m5/**main.py",
line
359, in main
exec filecode in scope
File "configs/example/hardcoded.py"**, line 46, in <module>
m5.instantiate()
File "/home/matara/Apps/gem5-**e71f71ce233a/src/python/m5/**
simulate.py",
line 106, in instantiate
for obj in root.descendants(): obj.createCCObject()
File "/home/matara/Apps/gem5-**e71f71ce233a/src/python/m5/**
SimObject.py",
line 1040, in createCCObject
self.getCCObject() # force creation
File "/home/matara/Apps/gem5-**e71f71ce233a/src/python/m5/**
SimObject.py",
line 1025, in getCCObject
self._ccObject = params.create()
AttributeError: 'MemObjectParams' object has no attribute 'create'
------------------------------**------------------------------**
------------------------------**--------
I copied my script mostly from Hipeac conference slides in tutorials;
You might want to try out gem5 with scripts from configs/examples/
directory. In particular, check whether se.py works for you or not. You can
read the documentation on gem5.org on how to use these scripts.
--
Nilay
Loading...