Discussion:
How to use stack distance calculator in gem5.
(too old to reply)
Bhaskar Kalita
2015-11-01 22:08:48 UTC
Permalink
Hi
I am Bhaskar. I am a final year B.E student. For my final year project I am
using the gem5 simulator. I need to collect the stack distance of programs
using gem5. I used the --debug-flag="StackDist", but it did not print
anything. I also tried setting the verifyStack flag in
mem/stack_dist_calc.hh to true as:
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
but it did not work too. For reference this is the command line am usuing:
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz'
--stats-file=forij.txt --dump-config=for.ini --json-config=for.json
configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches
--l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB
--l2_assoc=4 -c "bench/x86/forij;"

Can you please guide me through my problem and tell me to do the necessary
steps.

Thanks for your support

-Bhaskar
Andreas Hansson
2015-11-02 08:40:00 UTC
Permalink
Hi Bhaskar,

There are a few steps you need to take, and it involves a few widely-adopted gem5 concepts:

- First, the stack distance calculator is a probe, and the output is in the shape of gem5 stats. Thus, you need to instantiate the probe, and attach it to a probe point.

- Second, to be able to attach the probe in various locations in the memory system (core to L1, before the L2, in front of the system memory), we use a module called a CommMonitor, which has a bunch of generic stats, but also suitable packet probe points.

Consequently, you need to modify your script that assembles and configures the system, in your case se.py, and instantiate a CommMonitor, connect it where you want to monitor the communication, then instantiate a StackDistProbe and attach it to the monitor you just instantiated. The bad news is that it involves quite a few steps. The good news is that these are all things you will need to do as a gem5 user in any case, so better get used to it :-).

For an example, have a look at one of the regression scripts, tests/config/tgen-simple-mem.py. This script includes both trace generation, and calculation of stack distance. Note that you don’t need to set "verify = True" on the StackDistProbe. If you do you will calculate the stack distance both using a clever algorithm, and a “naïve” stack which is a lot slower.

Andreas


From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 1 November 2015 at 22:08
To: "gem5-***@gem5.org<mailto:gem5-***@gem5.org>" <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: [gem5-users] How to use stack distance calculator in gem5.


Hi
I am Bhaskar. I am a final year B.E student. For my final year project I am using the gem5 simulator. I need to collect the stack distance of programs using gem5. I used the --debug-flag="StackDist", but it did not print anything. I also tried setting the verifyStack flag in mem/stack_dist_calc.hh to true as:
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
but it did not work too. For reference this is the command line am usuing:
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini --json-config=for.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"

Can you please guide me through my problem and tell me to do the necessary steps.

Thanks for your support

-Bhaskar



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Bhaskar Kalita
2015-11-04 20:23:47 UTC
Permalink
Hi Andreas,

Thanks for your response. Can you please tell me how to instantiate the
probe. I tried modifying the se.py file as:

# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)

# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)


And also changed BaseCPU.py as:

def addTwoLevelCacheHierarchy(self, ic, dc, l2c, iwc = None, dwc = None):
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side

When I tried to run my program I got an error as "fatal: Communication
monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and what
are the other things to be done.

Thanks
Post by Andreas Hansson
Hi Bhaskar,
There are a few steps you need to take, and it involves a few
- First, the stack distance calculator is a probe, and the output is in
the shape of gem5 stats. Thus, you need to instantiate the probe, and
attach it to a probe point.
- Second, to be able to attach the probe in various locations in the
memory system (core to L1, before the L2, in front of the system memory),
we use a module called a CommMonitor, which has a bunch of generic stats,
but also suitable packet probe points.
Consequently, you need to modify your script that assembles and configures
the system, in your case se.py, and instantiate a CommMonitor, connect it
where you want to monitor the communication, then instantiate a
StackDistProbe and attach it to the monitor you just instantiated. The bad
news is that it involves quite a few steps. The good news is that these are
all things you will need to do as a gem5 user in any case, so better get
used to it :-).
For an example, have a look at one of the regression scripts,
tests/config/tgen-simple-mem.py. This script includes both trace
generation, and calculation of stack distance. Note that you don’t need to
set "verify = True" on the StackDistProbe. If you do you will calculate the
stack distance both using a clever algorithm, and a “naïve” stack which is
a lot slower.
Andreas
Date: Sunday, 1 November 2015 at 22:08
Subject: [gem5-users] How to use stack distance calculator in gem5.
Hi
I am Bhaskar. I am a final year B.E student. For my final year project I
am using the gem5 simulator. I need to collect the stack distance of
programs using gem5. I used the --debug-flag="StackDist", but it did not
print anything. I also tried setting the verifyStack flag in
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz'
--stats-file=forij.txt --dump-config=for.ini --json-config=for.json
configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches
--l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB
--l2_assoc=4 -c "bench/x86/forij;"
Can you please guide me through my problem and tell me to do the necessary steps.
Thanks for your support
-Bhaskar
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Andreas Hansson
2015-11-05 08:20:04 UTC
Permalink
Hi Bhaskar,

Have a look at tests/config/tgen-simple-mem.py.

The comm monitor has a master and a slave port, and you need to connect it “between” two other modules. There are plenty examples on the mailing list for adding it between the L1 and L2, for example by changing BaseCpu.py (if you do, remember to recompile). Once you have instantiated the comm monitor, and connected it, run an experiment and make sure you get the stats in the stats.txt output. Also, if you install pydot, you can see the system topology in m5out/config.dot.pdf or config.dot.svg (the latter even has mouseover tooltips etc).

When the things above are working, just assign a StackDistProbe to the comm monitor, as done in tests/config/tgen-simple-mem.py.

Good luck.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Wednesday, 4 November 2015 at 20:23
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

Thanks for your response. Can you please tell me how to instantiate the probe. I tried modifying the se.py file as:

# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)

# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)


And also changed BaseCPU.py as:

def addTwoLevelCacheHierarchy(self, ic, dc, l2c, iwc = None, dwc = None):
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side

When I tried to run my program I got an error as "fatal: Communication monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and what are the other things to be done.

Thanks



On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

There are a few steps you need to take, and it involves a few widely-adopted gem5 concepts:

- First, the stack distance calculator is a probe, and the output is in the shape of gem5 stats. Thus, you need to instantiate the probe, and attach it to a probe point.

- Second, to be able to attach the probe in various locations in the memory system (core to L1, before the L2, in front of the system memory), we use a module called a CommMonitor, which has a bunch of generic stats, but also suitable packet probe points.

Consequently, you need to modify your script that assembles and configures the system, in your case se.py, and instantiate a CommMonitor, connect it where you want to monitor the communication, then instantiate a StackDistProbe and attach it to the monitor you just instantiated. The bad news is that it involves quite a few steps. The good news is that these are all things you will need to do as a gem5 user in any case, so better get used to it :-).

For an example, have a look at one of the regression scripts, tests/config/tgen-simple-mem.py. This script includes both trace generation, and calculation of stack distance. Note that you don’t need to set "verify = True" on the StackDistProbe. If you do you will calculate the stack distance both using a clever algorithm, and a “naïve” stack which is a lot slower.

Andreas


From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 1 November 2015 at 22:08
To: "gem5-***@gem5.org<mailto:gem5-***@gem5.org>" <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: [gem5-users] How to use stack distance calculator in gem5.


Hi
I am Bhaskar. I am a final year B.E student. For my final year project I am using the gem5 simulator. I need to collect the stack distance of programs using gem5. I used the --debug-flag="StackDist", but it did not print anything. I also tried setting the verifyStack flag in mem/stack_dist_calc.hh to true as:
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
but it did not work too. For reference this is the command line am usuing:
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini --json-config=for.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"

Can you please guide me through my problem and tell me to do the necessary steps.

Thanks for your support

-Bhaskar



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Bhaskar Kalita
2015-11-05 23:33:44 UTC
Permalink
Hi Andreas

I want to measure the stack distance for l2 cache. So, tried to place the
CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I tried assigning a StackDistProbe to the comm monitor as:

stackdist = Param.StackDistProbe(NULL)

I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I
got while trying to run an example was

Traceback (most recent call last):
File "<string>", line 1, in <module>
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py",
line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py",
line 583, in run
m5.instantiate(checkpoint_dir)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py",
line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1453, in createCCObject
self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py",
line 248, in getValue
return [ v.getValue() for v in self ]
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration
hierarchy.


Can you please explain if I need to modify se.py for my purpose? Please
help me out through this as I am very new to gem5.


Thanks

Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
Have a look at tests/config/tgen-simple-mem.py.
The comm monitor has a master and a slave port, and you need to connect it
“between” two other modules. There are plenty examples on the mailing list
for adding it between the L1 and L2, for example by changing BaseCpu.py (if
you do, remember to recompile). Once you have instantiated the comm
monitor, and connected it, run an experiment and make sure you get the
stats in the stats.txt output. Also, if you install pydot, you can see the
system topology in m5out/config.dot.pdf or config.dot.svg (the latter even
has mouseover tooltips etc).
When the things above are working, just assign a StackDistProbe to the
comm monitor, as done in tests/config/tgen-simple-mem.py.
Good luck.
Andreas
Date: Wednesday, 4 November 2015 at 20:23
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
Thanks for your response. Can you please tell me how to instantiate the
# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)
# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side
When I tried to run my program I got an error as "fatal: Communication
monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and what
are the other things to be done.
Thanks
Post by Andreas Hansson
Hi Bhaskar,
There are a few steps you need to take, and it involves a few
- First, the stack distance calculator is a probe, and the output is in
the shape of gem5 stats. Thus, you need to instantiate the probe, and
attach it to a probe point.
- Second, to be able to attach the probe in various locations in the
memory system (core to L1, before the L2, in front of the system memory),
we use a module called a CommMonitor, which has a bunch of generic stats,
but also suitable packet probe points.
Consequently, you need to modify your script that assembles and
configures the system, in your case se.py, and instantiate a CommMonitor,
connect it where you want to monitor the communication, then instantiate a
StackDistProbe and attach it to the monitor you just instantiated. The bad
news is that it involves quite a few steps. The good news is that these are
all things you will need to do as a gem5 user in any case, so better get
used to it :-).
For an example, have a look at one of the regression scripts,
tests/config/tgen-simple-mem.py. This script includes both trace
generation, and calculation of stack distance. Note that you don’t need to
set "verify = True" on the StackDistProbe. If you do you will calculate the
stack distance both using a clever algorithm, and a “naïve” stack which is
a lot slower.
Andreas
Date: Sunday, 1 November 2015 at 22:08
Subject: [gem5-users] How to use stack distance calculator in gem5.
Hi
I am Bhaskar. I am a final year B.E student. For my final year project I
am using the gem5 simulator. I need to collect the stack distance of
programs using gem5. I used the --debug-flag="StackDist", but it did not
print anything. I also tried setting the verifyStack flag in
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz'
--stats-file=forij.txt --dump-config=for.ini --json-config=for.json
configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches
--l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB
--l2_assoc=4 -c "bench/x86/forij;"
Can you please guide me through my problem and tell me to do the necessary steps.
Thanks for your support
-Bhaskar
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Bhaskar Kalita
2015-11-08 12:16:34 UTC
Permalink
Hi Andreas,

You did not respond to my previous mail, hope you reply to this. I went
through the mail archive regarding CommMonitor. I tried again changing
BaseCPU.py as:

self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side

I re-compiled and tried to run an example but received the following error:

fatal: system.monitor.stackdist without default or user set value

For reference my command line was:

build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt
--dump-config=hello.ini --json-config=hello.json configs/example/se.py
--num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB
--l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c
'tests/test-progs/hello/bin/x86/linux/hello;'

Can you help me out where am making the mistake.

Thanks,
Bhaskar
Post by Bhaskar Kalita
Hi Andreas
I want to measure the stack distance for l2 cache. So, tried to place the
#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
stackdist = Param.StackDistProbe(NULL)
I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I
got while trying to run an example was
File "<string>", line 1, in <module>
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py",
line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py",
line 583, in run
m5.instantiate(checkpoint_dir)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py",
line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1453, in createCCObject
self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py",
line 248, in getValue
return [ v.getValue() for v in self ]
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration
hierarchy.
Can you please explain if I need to modify se.py for my purpose? Please
help me out through this as I am very new to gem5.
Thanks
Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
Have a look at tests/config/tgen-simple-mem.py.
The comm monitor has a master and a slave port, and you need to connect
it “between” two other modules. There are plenty examples on the mailing
list for adding it between the L1 and L2, for example by changing
BaseCpu.py (if you do, remember to recompile). Once you have instantiated
the comm monitor, and connected it, run an experiment and make sure you get
the stats in the stats.txt output. Also, if you install pydot, you can see
the system topology in m5out/config.dot.pdf or config.dot.svg (the latter
even has mouseover tooltips etc).
When the things above are working, just assign a StackDistProbe to the
comm monitor, as done in tests/config/tgen-simple-mem.py.
Good luck.
Andreas
Date: Wednesday, 4 November 2015 at 20:23
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
Thanks for your response. Can you please tell me how to instantiate the
# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)
# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side
When I tried to run my program I got an error as "fatal: Communication
monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and
what are the other things to be done.
Thanks
Post by Andreas Hansson
Hi Bhaskar,
There are a few steps you need to take, and it involves a few
- First, the stack distance calculator is a probe, and the output is in
the shape of gem5 stats. Thus, you need to instantiate the probe, and
attach it to a probe point.
- Second, to be able to attach the probe in various locations in the
memory system (core to L1, before the L2, in front of the system memory),
we use a module called a CommMonitor, which has a bunch of generic stats,
but also suitable packet probe points.
Consequently, you need to modify your script that assembles and
configures the system, in your case se.py, and instantiate a CommMonitor,
connect it where you want to monitor the communication, then instantiate a
StackDistProbe and attach it to the monitor you just instantiated. The bad
news is that it involves quite a few steps. The good news is that these are
all things you will need to do as a gem5 user in any case, so better get
used to it :-).
For an example, have a look at one of the regression scripts,
tests/config/tgen-simple-mem.py. This script includes both trace
generation, and calculation of stack distance. Note that you don’t need to
set "verify = True" on the StackDistProbe. If you do you will calculate the
stack distance both using a clever algorithm, and a “naïve” stack which is
a lot slower.
Andreas
Date: Sunday, 1 November 2015 at 22:08
Subject: [gem5-users] How to use stack distance calculator in gem5.
Hi
I am Bhaskar. I am a final year B.E student. For my final year project I
am using the gem5 simulator. I need to collect the stack distance of
programs using gem5. I used the --debug-flag="StackDist", but it did not
print anything. I also tried setting the verifyStack flag in
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz'
--stats-file=forij.txt --dump-config=for.ini --json-config=for.json
configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches
--l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB
--l2_assoc=4 -c "bench/x86/forij;"
Can you please guide me through my problem and tell me to do the necessary steps.
Thanks for your support
-Bhaskar
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Andreas Hansson
2015-11-08 17:04:15 UTC
Permalink
Hi Bhaskar,

Something is not quite right in the topology you are expressing in these lines. Have you looked at the graphical output (make sure you have py-dot installed)?

You want to trace _after_ the l2? If so, I would suggest to connect the L2 cache as usual. Then instantiate and connect the monitor:

self.monitor = CommMonitor()
self.monitor.slave = self.l2cache.mem_side
self._cached_ports = [‘monitor.master’]

This will leave the CommMonitor as the “exposed” port being connected downwards.

Make sure this is all working before you start fiddling with the probes. The graphical output is your friend


Once the above is working, it should just be a matter of adding a line:

self.monitor.sdprobe = StackDistProbe()

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 8 November 2015 at 12:16
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

You did not respond to my previous mail, hope you reply to this. I went through the mail archive regarding CommMonitor. I tried again changing BaseCPU.py as:

self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side

I re-compiled and tried to run an example but received the following error:

fatal: system.monitor.stackdist without default or user set value

For reference my command line was:

build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt --dump-config=hello.ini --json-config=hello.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c 'tests/test-progs/hello/bin/x86/linux/hello;'

Can you help me out where am making the mistake.

Thanks,
Bhaskar





On Fri, Nov 6, 2015 at 5:03 AM, Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi Andreas

I want to measure the stack distance for l2 cache. So, tried to place the CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I tried assigning a StackDistProbe to the comm monitor as:

stackdist = Param.StackDistProbe(NULL)

I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I got while trying to run an example was

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py", line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py", line 583, in run
m5.instantiate(checkpoint_dir)
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py", line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1453, in createCCObject
self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1435, in getCCObject
params = self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py", line 248, in getValue
return [ v.getValue() for v in self ]
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1435, in getCCObject
params = self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration hierarchy.


Can you please explain if I need to modify se.py for my purpose? Please help me out through this as I am very new to gem5.


Thanks

Bhaskar





On Thu, Nov 5, 2015 at 1:50 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Have a look at tests/config/tgen-simple-mem.py.

The comm monitor has a master and a slave port, and you need to connect it “between” two other modules. There are plenty examples on the mailing list for adding it between the L1 and L2, for example by changing BaseCpu.py (if you do, remember to recompile). Once you have instantiated the comm monitor, and connected it, run an experiment and make sure you get the stats in the stats.txt output. Also, if you install pydot, you can see the system topology in m5out/config.dot.pdf or config.dot.svg (the latter even has mouseover tooltips etc).

When the things above are working, just assign a StackDistProbe to the comm monitor, as done in tests/config/tgen-simple-mem.py.

Good luck.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Wednesday, 4 November 2015 at 20:23
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

Thanks for your response. Can you please tell me how to instantiate the probe. I tried modifying the se.py file as:

# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)

# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)


And also changed BaseCPU.py as:

def addTwoLevelCacheHierarchy(self, ic, dc, l2c, iwc = None, dwc = None):
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side

When I tried to run my program I got an error as "fatal: Communication monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and what are the other things to be done.

Thanks



On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

There are a few steps you need to take, and it involves a few widely-adopted gem5 concepts:

- First, the stack distance calculator is a probe, and the output is in the shape of gem5 stats. Thus, you need to instantiate the probe, and attach it to a probe point.

- Second, to be able to attach the probe in various locations in the memory system (core to L1, before the L2, in front of the system memory), we use a module called a CommMonitor, which has a bunch of generic stats, but also suitable packet probe points.

Consequently, you need to modify your script that assembles and configures the system, in your case se.py, and instantiate a CommMonitor, connect it where you want to monitor the communication, then instantiate a StackDistProbe and attach it to the monitor you just instantiated. The bad news is that it involves quite a few steps. The good news is that these are all things you will need to do as a gem5 user in any case, so better get used to it :-).

For an example, have a look at one of the regression scripts, tests/config/tgen-simple-mem.py. This script includes both trace generation, and calculation of stack distance. Note that you don’t need to set "verify = True" on the StackDistProbe. If you do you will calculate the stack distance both using a clever algorithm, and a “naïve” stack which is a lot slower.

Andreas


From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 1 November 2015 at 22:08
To: "gem5-***@gem5.org<mailto:gem5-***@gem5.org>" <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: [gem5-users] How to use stack distance calculator in gem5.


Hi
I am Bhaskar. I am a final year B.E student. For my final year project I am using the gem5 simulator. I need to collect the stack distance of programs using gem5. I used the --debug-flag="StackDist", but it did not print anything. I also tried setting the verifyStack flag in mem/stack_dist_calc.hh to true as:
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
but it did not work too. For reference this is the command line am usuing:
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini --json-config=for.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"

Can you please guide me through my problem and tell me to do the necessary steps.

Thanks for your support

-Bhaskar



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Bhaskar Kalita
2015-11-11 10:36:41 UTC
Permalink
Hi Andreas;

I installed pydot. Now am more clear with the topology. I want to put the
monitor "before L2". So, tried changing BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
self.monitor = CommMonitor()
self.monitor.StackDist = StackDistProbe(verify = True)
self.toL2Bus.master = self.monitor.slave
self.monitor.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I recompiled and and trier to run an example and received error as:

fatal: system.monitor.stackdist without default or user set value

And I also cannot see the CommMonitor anywhere in the in the dot files.

Do I also need to make change in se.py and CommMonitor.py??? I have
attached the three files for reference.

Thanks,

Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
Something is not quite right in the topology you are expressing in these
lines. Have you looked at the graphical output (make sure you have py-dot
installed)?
You want to trace _after_ the l2? If so, I would suggest to connect the L2
self.monitor = CommMonitor()
self.monitor.slave = self.l2cache.mem_side
self._cached_ports = [‘monitor.master’]
This will leave the CommMonitor as the “exposed” port being connected downwards.
Make sure this is all working before you start fiddling with the probes.
The graphical output is your friend

self.monitor.sdprobe = StackDistProbe()
Andreas
Date: Sunday, 8 November 2015 at 12:16
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
You did not respond to my previous mail, hope you reply to this. I went
through the mail archive regarding CommMonitor. I tried again changing
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side
fatal: system.monitor.stackdist without default or user set value
build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt
--dump-config=hello.ini --json-config=hello.json configs/example/se.py
--num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB
--l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c
'tests/test-progs/hello/bin/x86/linux/hello;'
Can you help me out where am making the mistake.
Thanks,
Bhaskar
Post by Bhaskar Kalita
Hi Andreas
I want to measure the stack distance for l2 cache. So, tried to place the
#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
stackdist = Param.StackDistProbe(NULL)
I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I
got while trying to run an example was
File "<string>", line 1, in <module>
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py",
line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py",
line 583, in run
m5.instantiate(checkpoint_dir)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py",
line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1453, in createCCObject
self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py",
line 248, in getValue
return [ v.getValue() for v in self ]
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration hierarchy.
Can you please explain if I need to modify se.py for my purpose? Please
help me out through this as I am very new to gem5.
Thanks
Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
Have a look at tests/config/tgen-simple-mem.py.
The comm monitor has a master and a slave port, and you need to connect
it “between” two other modules. There are plenty examples on the mailing
list for adding it between the L1 and L2, for example by changing
BaseCpu.py (if you do, remember to recompile). Once you have instantiated
the comm monitor, and connected it, run an experiment and make sure you get
the stats in the stats.txt output. Also, if you install pydot, you can see
the system topology in m5out/config.dot.pdf or config.dot.svg (the latter
even has mouseover tooltips etc).
When the things above are working, just assign a StackDistProbe to the
comm monitor, as done in tests/config/tgen-simple-mem.py.
Good luck.
Andreas
Date: Wednesday, 4 November 2015 at 20:23
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
Thanks for your response. Can you please tell me how to instantiate the
# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)
# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side
When I tried to run my program I got an error as "fatal: Communication
monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and
what are the other things to be done.
Thanks
Post by Andreas Hansson
Hi Bhaskar,
There are a few steps you need to take, and it involves a few
- First, the stack distance calculator is a probe, and the output is in
the shape of gem5 stats. Thus, you need to instantiate the probe, and
attach it to a probe point.
- Second, to be able to attach the probe in various locations in the
memory system (core to L1, before the L2, in front of the system memory),
we use a module called a CommMonitor, which has a bunch of generic stats,
but also suitable packet probe points.
Consequently, you need to modify your script that assembles and
configures the system, in your case se.py, and instantiate a CommMonitor,
connect it where you want to monitor the communication, then instantiate a
StackDistProbe and attach it to the monitor you just instantiated. The bad
news is that it involves quite a few steps. The good news is that these are
all things you will need to do as a gem5 user in any case, so better get
used to it :-).
For an example, have a look at one of the regression scripts,
tests/config/tgen-simple-mem.py. This script includes both trace
generation, and calculation of stack distance. Note that you don’t need to
set "verify = True" on the StackDistProbe. If you do you will calculate the
stack distance both using a clever algorithm, and a “naïve” stack which is
a lot slower.
Andreas
Date: Sunday, 1 November 2015 at 22:08
Subject: [gem5-users] How to use stack distance calculator in gem5.
Hi
I am Bhaskar. I am a final year B.E student. For my final year project
I am using the gem5 simulator. I need to collect the stack distance of
programs using gem5. I used the --debug-flag="StackDist", but it did not
print anything. I also tried setting the verifyStack flag in
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz'
--stats-file=forij.txt --dump-config=for.ini --json-config=for.json
configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches
--l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB
--l2_assoc=4 -c "bench/x86/forij;"
Can you please guide me through my problem and tell me to do the necessary steps.
Thanks for your support
-Bhaskar
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Andreas Hansson
2015-11-12 22:16:09 UTC
Permalink
Hi Bhaskar,

Have you sorted out your issues? I just tried adding these lines to the gem5 trunk (not the gem5-stable repo) and it does the job for the regression scripts. The se.py and fs.py scripts don’t call this function in BaseCPU (unfortunately we do things differently in different scripts), so for these you have to do the corresponding changes in configs/common/CacheConfig where the l2 is added.

Also, be mindful of the indentation in Python files.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Wednesday, 11 November 2015 at 10:36
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas;

I installed pydot. Now am more clear with the topology. I want to put the monitor "before L2". So, tried changing BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
self.monitor = CommMonitor()
self.monitor.StackDist = StackDistProbe(verify = True)
self.toL2Bus.master = self.monitor.slave
self.monitor.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I recompiled and and trier to run an example and received error as:

fatal: system.monitor.stackdist without default or user set value

And I also cannot see the CommMonitor anywhere in the in the dot files.

Do I also need to make change in se.py and CommMonitor.py??? I have attached the three files for reference.

Thanks,

Bhaskar







On Sun, Nov 8, 2015 at 10:34 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Something is not quite right in the topology you are expressing in these lines. Have you looked at the graphical output (make sure you have py-dot installed)?

You want to trace _after_ the l2? If so, I would suggest to connect the L2 cache as usual. Then instantiate and connect the monitor:

self.monitor = CommMonitor()
self.monitor.slave = self.l2cache.mem_side
self._cached_ports = [‘monitor.master’]

This will leave the CommMonitor as the “exposed” port being connected downwards.

Make sure this is all working before you start fiddling with the probes. The graphical output is your friend


Once the above is working, it should just be a matter of adding a line:

self.monitor.sdprobe = StackDistProbe()

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 8 November 2015 at 12:16

To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

You did not respond to my previous mail, hope you reply to this. I went through the mail archive regarding CommMonitor. I tried again changing BaseCPU.py as:

self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side

I re-compiled and tried to run an example but received the following error:

fatal: system.monitor.stackdist without default or user set value

For reference my command line was:

build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt --dump-config=hello.ini --json-config=hello.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c 'tests/test-progs/hello/bin/x86/linux/hello;'

Can you help me out where am making the mistake.

Thanks,
Bhaskar





On Fri, Nov 6, 2015 at 5:03 AM, Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi Andreas

I want to measure the stack distance for l2 cache. So, tried to place the CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I tried assigning a StackDistProbe to the comm monitor as:

stackdist = Param.StackDistProbe(NULL)

I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I got while trying to run an example was

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py", line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py", line 583, in run
m5.instantiate(checkpoint_dir)
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py", line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1453, in createCCObject
self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1435, in getCCObject
params = self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py", line 248, in getValue
return [ v.getValue() for v in self ]
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1435, in getCCObject
params = self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration hierarchy.


Can you please explain if I need to modify se.py for my purpose? Please help me out through this as I am very new to gem5.


Thanks

Bhaskar





On Thu, Nov 5, 2015 at 1:50 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Have a look at tests/config/tgen-simple-mem.py.

The comm monitor has a master and a slave port, and you need to connect it “between” two other modules. There are plenty examples on the mailing list for adding it between the L1 and L2, for example by changing BaseCpu.py (if you do, remember to recompile). Once you have instantiated the comm monitor, and connected it, run an experiment and make sure you get the stats in the stats.txt output. Also, if you install pydot, you can see the system topology in m5out/config.dot.pdf or config.dot.svg (the latter even has mouseover tooltips etc).

When the things above are working, just assign a StackDistProbe to the comm monitor, as done in tests/config/tgen-simple-mem.py.

Good luck.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Wednesday, 4 November 2015 at 20:23
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

Thanks for your response. Can you please tell me how to instantiate the probe. I tried modifying the se.py file as:

# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)

# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)


And also changed BaseCPU.py as:

def addTwoLevelCacheHierarchy(self, ic, dc, l2c, iwc = None, dwc = None):
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side

When I tried to run my program I got an error as "fatal: Communication monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and what are the other things to be done.

Thanks



On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

There are a few steps you need to take, and it involves a few widely-adopted gem5 concepts:

- First, the stack distance calculator is a probe, and the output is in the shape of gem5 stats. Thus, you need to instantiate the probe, and attach it to a probe point.

- Second, to be able to attach the probe in various locations in the memory system (core to L1, before the L2, in front of the system memory), we use a module called a CommMonitor, which has a bunch of generic stats, but also suitable packet probe points.

Consequently, you need to modify your script that assembles and configures the system, in your case se.py, and instantiate a CommMonitor, connect it where you want to monitor the communication, then instantiate a StackDistProbe and attach it to the monitor you just instantiated. The bad news is that it involves quite a few steps. The good news is that these are all things you will need to do as a gem5 user in any case, so better get used to it :-).

For an example, have a look at one of the regression scripts, tests/config/tgen-simple-mem.py. This script includes both trace generation, and calculation of stack distance. Note that you don’t need to set "verify = True" on the StackDistProbe. If you do you will calculate the stack distance both using a clever algorithm, and a “naïve” stack which is a lot slower.

Andreas


From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 1 November 2015 at 22:08
To: "gem5-***@gem5.org<mailto:gem5-***@gem5.org>" <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: [gem5-users] How to use stack distance calculator in gem5.


Hi
I am Bhaskar. I am a final year B.E student. For my final year project I am using the gem5 simulator. I need to collect the stack distance of programs using gem5. I used the --debug-flag="StackDist", but it did not print anything. I also tried setting the verifyStack flag in mem/stack_dist_calc.hh to true as:
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
but it did not work too. For reference this is the command line am usuing:
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini --json-config=for.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"

Can you please guide me through my problem and tell me to do the necessary steps.

Thanks for your support

-Bhaskar



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Bhaskar Kalita
2015-12-18 17:07:59 UTC
Permalink
Hi Andreas,

Thanks for your help. I am able to obtain the sdp by adding the following
lines in CacheConfig.py:

system.monitor = CommMonitor()
system.monitor.trace = MemTraceProbe(trace_file = "monitor.ptrc.gz")
system.monitor.stackdist = StackDistProbe( disable_log_hists = True )
system.l2.cpu_side = system.monitor.master
system.monitor.slave = system.tol2bus.master
#system.l2.cpu_side = system.tol2bus.master
system.l2.mem_side = system.membus.slave

The sdp is obtained in the stats,txt file. And the values are generalized
in a range like:

system.monitor.stack_dist_calc.readLinearHist::0-127 6
12.24% 12.24% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::128-255 8
16.33% 28.57% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::256-383 4
8.16% 36.73% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::384-511 0
0.00% 36.73% # Reads linear distribution

Do the numbers 0-127 refer to the cache lines???
Is their a way to print this value in a separate file???
How can I find the values for every distinct lines???
Post by Andreas Hansson
Hi Bhaskar,
Have you sorted out your issues? I just tried adding these lines to the
gem5 trunk (not the gem5-stable repo) and it does the job for the
regression scripts. The se.py and fs.py scripts don’t call this function in
BaseCPU (unfortunately we do things differently in different scripts), so
for these you have to do the corresponding changes in
configs/common/CacheConfig where the l2 is added.
Also, be mindful of the indentation in Python files.
Andreas
Date: Wednesday, 11 November 2015 at 10:36
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas;
I installed pydot. Now am more clear with the topology. I want to put the
#self.toL2Bus.master = self.l2cache.cpu_side
self.monitor = CommMonitor()
self.monitor.StackDist = StackDistProbe(verify = True)
self.toL2Bus.master = self.monitor.slave
self.monitor.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
fatal: system.monitor.stackdist without default or user set value
And I also cannot see the CommMonitor anywhere in the in the dot files.
Do I also need to make change in se.py and CommMonitor.py??? I have
attached the three files for reference.
Thanks,
Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
Something is not quite right in the topology you are expressing in these
lines. Have you looked at the graphical output (make sure you have py-dot
installed)?
You want to trace _after_ the l2? If so, I would suggest to connect the
self.monitor = CommMonitor()
self.monitor.slave = self.l2cache.mem_side
self._cached_ports = [‘monitor.master’]
This will leave the CommMonitor as the “exposed” port being connected
downwards.
Make sure this is all working before you start fiddling with the probes.
The graphical output is your friend

self.monitor.sdprobe = StackDistProbe()
Andreas
Date: Sunday, 8 November 2015 at 12:16
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
You did not respond to my previous mail, hope you reply to this. I went
through the mail archive regarding CommMonitor. I tried again changing
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side
fatal: system.monitor.stackdist without default or user set value
build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt
--dump-config=hello.ini --json-config=hello.json configs/example/se.py
--num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB
--l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c
'tests/test-progs/hello/bin/x86/linux/hello;'
Can you help me out where am making the mistake.
Thanks,
Bhaskar
Post by Bhaskar Kalita
Hi Andreas
I want to measure the stack distance for l2 cache. So, tried to place
the CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py
#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
stackdist = Param.StackDistProbe(NULL)
I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I
got while trying to run an example was
File "<string>", line 1, in <module>
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py",
line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py",
line 583, in run
m5.instantiate(checkpoint_dir)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py",
line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1453, in createCCObject
self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py",
line 248, in getValue
return [ v.getValue() for v in self ]
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration hierarchy.
Can you please explain if I need to modify se.py for my purpose? Please
help me out through this as I am very new to gem5.
Thanks
Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
Have a look at tests/config/tgen-simple-mem.py.
The comm monitor has a master and a slave port, and you need to connect
it “between” two other modules. There are plenty examples on the mailing
list for adding it between the L1 and L2, for example by changing
BaseCpu.py (if you do, remember to recompile). Once you have instantiated
the comm monitor, and connected it, run an experiment and make sure you get
the stats in the stats.txt output. Also, if you install pydot, you can see
the system topology in m5out/config.dot.pdf or config.dot.svg (the latter
even has mouseover tooltips etc).
When the things above are working, just assign a StackDistProbe to the
comm monitor, as done in tests/config/tgen-simple-mem.py.
Good luck.
Andreas
Date: Wednesday, 4 November 2015 at 20:23
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
Thanks for your response. Can you please tell me how to instantiate the
# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)
# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side
When I tried to run my program I got an error as "fatal: Communication
monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and
what are the other things to be done.
Thanks
On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <
Post by Andreas Hansson
Hi Bhaskar,
There are a few steps you need to take, and it involves a few
- First, the stack distance calculator is a probe, and the output is
in the shape of gem5 stats. Thus, you need to instantiate the probe, and
attach it to a probe point.
- Second, to be able to attach the probe in various locations in the
memory system (core to L1, before the L2, in front of the system memory),
we use a module called a CommMonitor, which has a bunch of generic stats,
but also suitable packet probe points.
Consequently, you need to modify your script that assembles and
configures the system, in your case se.py, and instantiate a CommMonitor,
connect it where you want to monitor the communication, then instantiate a
StackDistProbe and attach it to the monitor you just instantiated. The bad
news is that it involves quite a few steps. The good news is that these are
all things you will need to do as a gem5 user in any case, so better get
used to it :-).
For an example, have a look at one of the regression scripts,
tests/config/tgen-simple-mem.py. This script includes both trace
generation, and calculation of stack distance. Note that you don’t need to
set "verify = True" on the StackDistProbe. If you do you will calculate the
stack distance both using a clever algorithm, and a “naïve” stack which is
a lot slower.
Andreas
Date: Sunday, 1 November 2015 at 22:08
Subject: [gem5-users] How to use stack distance calculator in gem5.
Hi
I am Bhaskar. I am a final year B.E student. For my final year project
I am using the gem5 simulator. I need to collect the stack distance of
programs using gem5. I used the --debug-flag="StackDist", but it did not
print anything. I also tried setting the verifyStack flag in
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
build/X86/gem5.debug --debug-flag='StackDist'
--debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini
--json-config=for.json configs/example/se.py --num-cpus=1
--cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache
--num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"
Can you please guide me through my problem and tell me to do the necessary steps.
Thanks for your support
-Bhaskar
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments
are confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Andreas Hansson
2015-12-19 10:19:26 UTC
Permalink
Hi Bhaskar,

The values refer to stack distances, measures in accesses. Thus, you have 6 requests/packets where the stack distance is between 0 and 127.

I don’t understand why you want them in a separate file. gem5 relies on a centralised stats.txt, you can change the name, but all the stats will end up in the same file.

If you want the stack distance for a specific address you will have to change the source. The probe is intended to scale to large datasets and long simulation runs, so it needs to handle hundreds of millions of accesses. I honestly do not understand why you want it per line
but if you do you will have to hack away.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Friday, 18 December 2015 at 17:07
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

Thanks for your help. I am able to obtain the sdp by adding the following lines in CacheConfig.py:

system.monitor = CommMonitor()
system.monitor.trace = MemTraceProbe(trace_file = "monitor.ptrc.gz")
system.monitor.stackdist = StackDistProbe( disable_log_hists = True )
system.l2.cpu_side = system.monitor.master
system.monitor.slave = system.tol2bus.master
#system.l2.cpu_side = system.tol2bus.master
system.l2.mem_side = system.membus.slave

The sdp is obtained in the stats,txt file. And the values are generalized in a range like:

system.monitor.stack_dist_calc.readLinearHist::0-127 6 12.24% 12.24% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::128-255 8 16.33% 28.57% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::256-383 4 8.16% 36.73% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::384-511 0 0.00% 36.73% # Reads linear distribution

Do the numbers 0-127 refer to the cache lines???
Is their a way to print this value in a separate file???
How can I find the values for every distinct lines???



On Fri, Nov 13, 2015 at 3:46 AM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Have you sorted out your issues? I just tried adding these lines to the gem5 trunk (not the gem5-stable repo) and it does the job for the regression scripts. The se.py and fs.py scripts don’t call this function in BaseCPU (unfortunately we do things differently in different scripts), so for these you have to do the corresponding changes in configs/common/CacheConfig where the l2 is added.

Also, be mindful of the indentation in Python files.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Wednesday, 11 November 2015 at 10:36

To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas;

I installed pydot. Now am more clear with the topology. I want to put the monitor "before L2". So, tried changing BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
self.monitor = CommMonitor()
self.monitor.StackDist = StackDistProbe(verify = True)
self.toL2Bus.master = self.monitor.slave
self.monitor.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I recompiled and and trier to run an example and received error as:

fatal: system.monitor.stackdist without default or user set value

And I also cannot see the CommMonitor anywhere in the in the dot files.

Do I also need to make change in se.py and CommMonitor.py??? I have attached the three files for reference.

Thanks,

Bhaskar







On Sun, Nov 8, 2015 at 10:34 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Something is not quite right in the topology you are expressing in these lines. Have you looked at the graphical output (make sure you have py-dot installed)?

You want to trace _after_ the l2? If so, I would suggest to connect the L2 cache as usual. Then instantiate and connect the monitor:

self.monitor = CommMonitor()
self.monitor.slave = self.l2cache.mem_side
self._cached_ports = [‘monitor.master’]

This will leave the CommMonitor as the “exposed” port being connected downwards.

Make sure this is all working before you start fiddling with the probes. The graphical output is your friend


Once the above is working, it should just be a matter of adding a line:

self.monitor.sdprobe = StackDistProbe()

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 8 November 2015 at 12:16

To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

You did not respond to my previous mail, hope you reply to this. I went through the mail archive regarding CommMonitor. I tried again changing BaseCPU.py as:

self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side

I re-compiled and tried to run an example but received the following error:

fatal: system.monitor.stackdist without default or user set value

For reference my command line was:

build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt --dump-config=hello.ini --json-config=hello.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c 'tests/test-progs/hello/bin/x86/linux/hello;'

Can you help me out where am making the mistake.

Thanks,
Bhaskar





On Fri, Nov 6, 2015 at 5:03 AM, Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi Andreas

I want to measure the stack distance for l2 cache. So, tried to place the CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I tried assigning a StackDistProbe to the comm monitor as:

stackdist = Param.StackDistProbe(NULL)

I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I got while trying to run an example was

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py", line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py", line 583, in run
m5.instantiate(checkpoint_dir)
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py", line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1453, in createCCObject
self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1435, in getCCObject
params = self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py", line 248, in getValue
return [ v.getValue() for v in self ]
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1435, in getCCObject
params = self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration hierarchy.


Can you please explain if I need to modify se.py for my purpose? Please help me out through this as I am very new to gem5.


Thanks

Bhaskar





On Thu, Nov 5, 2015 at 1:50 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Have a look at tests/config/tgen-simple-mem.py.

The comm monitor has a master and a slave port, and you need to connect it “between” two other modules. There are plenty examples on the mailing list for adding it between the L1 and L2, for example by changing BaseCpu.py (if you do, remember to recompile). Once you have instantiated the comm monitor, and connected it, run an experiment and make sure you get the stats in the stats.txt output. Also, if you install pydot, you can see the system topology in m5out/config.dot.pdf or config.dot.svg (the latter even has mouseover tooltips etc).

When the things above are working, just assign a StackDistProbe to the comm monitor, as done in tests/config/tgen-simple-mem.py.

Good luck.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Wednesday, 4 November 2015 at 20:23
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

Thanks for your response. Can you please tell me how to instantiate the probe. I tried modifying the se.py file as:

# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)

# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)


And also changed BaseCPU.py as:

def addTwoLevelCacheHierarchy(self, ic, dc, l2c, iwc = None, dwc = None):
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side

When I tried to run my program I got an error as "fatal: Communication monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and what are the other things to be done.

Thanks



On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

There are a few steps you need to take, and it involves a few widely-adopted gem5 concepts:

- First, the stack distance calculator is a probe, and the output is in the shape of gem5 stats. Thus, you need to instantiate the probe, and attach it to a probe point.

- Second, to be able to attach the probe in various locations in the memory system (core to L1, before the L2, in front of the system memory), we use a module called a CommMonitor, which has a bunch of generic stats, but also suitable packet probe points.

Consequently, you need to modify your script that assembles and configures the system, in your case se.py, and instantiate a CommMonitor, connect it where you want to monitor the communication, then instantiate a StackDistProbe and attach it to the monitor you just instantiated. The bad news is that it involves quite a few steps. The good news is that these are all things you will need to do as a gem5 user in any case, so better get used to it :-).

For an example, have a look at one of the regression scripts, tests/config/tgen-simple-mem.py. This script includes both trace generation, and calculation of stack distance. Note that you don’t need to set "verify = True" on the StackDistProbe. If you do you will calculate the stack distance both using a clever algorithm, and a “naïve” stack which is a lot slower.

Andreas


From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 1 November 2015 at 22:08
To: "gem5-***@gem5.org<mailto:gem5-***@gem5.org>" <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: [gem5-users] How to use stack distance calculator in gem5.


Hi
I am Bhaskar. I am a final year B.E student. For my final year project I am using the gem5 simulator. I need to collect the stack distance of programs using gem5. I used the --debug-flag="StackDist", but it did not print anything. I also tried setting the verifyStack flag in mem/stack_dist_calc.hh to true as:
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
but it did not work too. For reference this is the command line am usuing:
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini --json-config=for.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"

Can you please guide me through my problem and tell me to do the necessary steps.

Thanks for your support

-Bhaskar



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Bhaskar Kalita
2016-01-13 13:07:09 UTC
Permalink
Hi Andreas,

I want the values for every specific distance. Can you tell me which files
do I need to change to do so? I require the values in that format to input
it in a scheduling simulator named SimSo in the form of the SDP file of a
task. The simulator takes the values for ever particular distance rather
than in a generalized form. So it will be better if I could get the values
in this format using gem5.


0 .3946537296
1 .1320268926
2 .0680432691
3 .0526663317
4 .0700712422
5 .0308234477
6 .0356989232
7 .0200548268
8 .0118467264
9 .0195609635
10 .0122696827
11 .0052761524
12 .0032688299
13 .0091512174
14 .0038000460
15 .0030201249
16 .0012057944
17 .0034824725
18 .0047665379

In earlier work I have read that this type of SDP was obtained by using
gem5. So if you could tell me where I can make the changes ????

Thanks,
Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
The values refer to stack distances, measures in accesses. Thus, you have
6 requests/packets where the stack distance is between 0 and 127.
I don’t understand why you want them in a separate file. gem5 relies on a
centralised stats.txt, you can change the name, but all the stats will end
up in the same file.
If you want the stack distance for a specific address you will have to
change the source. The probe is intended to scale to large datasets and
long simulation runs, so it needs to handle hundreds of millions of
accesses. I honestly do not understand why you want it per line
but if you
do you will have to hack away.
Andreas
Date: Friday, 18 December 2015 at 17:07
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
Thanks for your help. I am able to obtain the sdp by adding the following
system.monitor = CommMonitor()
system.monitor.trace = MemTraceProbe(trace_file = "monitor.ptrc.gz")
system.monitor.stackdist = StackDistProbe( disable_log_hists = True )
system.l2.cpu_side = system.monitor.master
system.monitor.slave = system.tol2bus.master
#system.l2.cpu_side = system.tol2bus.master
system.l2.mem_side = system.membus.slave
system.monitor.stack_dist_calc.readLinearHist::0-127 6
12.24% 12.24% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::128-255 8
16.33% 28.57% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::256-383 4
8.16% 36.73% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::384-511 0
0.00% 36.73% # Reads linear distribution
Do the numbers 0-127 refer to the cache lines???
Is their a way to print this value in a separate file???
How can I find the values for every distinct lines???
Post by Andreas Hansson
Hi Bhaskar,
Have you sorted out your issues? I just tried adding these lines to the
gem5 trunk (not the gem5-stable repo) and it does the job for the
regression scripts. The se.py and fs.py scripts don’t call this function in
BaseCPU (unfortunately we do things differently in different scripts), so
for these you have to do the corresponding changes in
configs/common/CacheConfig where the l2 is added.
Also, be mindful of the indentation in Python files.
Andreas
Date: Wednesday, 11 November 2015 at 10:36
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas;
I installed pydot. Now am more clear with the topology. I want to put the
#self.toL2Bus.master = self.l2cache.cpu_side
self.monitor = CommMonitor()
self.monitor.StackDist = StackDistProbe(verify = True)
self.toL2Bus.master = self.monitor.slave
self.monitor.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
fatal: system.monitor.stackdist without default or user set value
And I also cannot see the CommMonitor anywhere in the in the dot files.
Do I also need to make change in se.py and CommMonitor.py??? I have
attached the three files for reference.
Thanks,
Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
Something is not quite right in the topology you are expressing in these
lines. Have you looked at the graphical output (make sure you have py-dot
installed)?
You want to trace _after_ the l2? If so, I would suggest to connect the
self.monitor = CommMonitor()
self.monitor.slave = self.l2cache.mem_side
self._cached_ports = [‘monitor.master’]
This will leave the CommMonitor as the “exposed” port being connected
downwards.
Make sure this is all working before you start fiddling with the probes.
The graphical output is your friend

self.monitor.sdprobe = StackDistProbe()
Andreas
Date: Sunday, 8 November 2015 at 12:16
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
You did not respond to my previous mail, hope you reply to this. I went
through the mail archive regarding CommMonitor. I tried again changing
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side
fatal: system.monitor.stackdist without default or user set value
build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt
--dump-config=hello.ini --json-config=hello.json configs/example/se.py
--num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB
--l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c
'tests/test-progs/hello/bin/x86/linux/hello;'
Can you help me out where am making the mistake.
Thanks,
Bhaskar
Post by Bhaskar Kalita
Hi Andreas
I want to measure the stack distance for l2 cache. So, tried to place
the CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py
#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
stackdist = Param.StackDistProbe(NULL)
I re-compiled as scons build/X86/gem5.debug. It worked fine. The error
I got while trying to run an example was
File "<string>", line 1, in <module>
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py",
line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py",
line 583, in run
m5.instantiate(checkpoint_dir)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py",
line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1453, in createCCObject
self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py",
line 248, in getValue
return [ v.getValue() for v in self ]
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration hierarchy.
Can you please explain if I need to modify se.py for my purpose? Please
help me out through this as I am very new to gem5.
Thanks
Bhaskar
On Thu, Nov 5, 2015 at 1:50 PM, Andreas Hansson <
Post by Andreas Hansson
Hi Bhaskar,
Have a look at tests/config/tgen-simple-mem.py.
The comm monitor has a master and a slave port, and you need to
connect it “between” two other modules. There are plenty examples on the
mailing list for adding it between the L1 and L2, for example by changing
BaseCpu.py (if you do, remember to recompile). Once you have instantiated
the comm monitor, and connected it, run an experiment and make sure you get
the stats in the stats.txt output. Also, if you install pydot, you can see
the system topology in m5out/config.dot.pdf or config.dot.svg (the latter
even has mouseover tooltips etc).
When the things above are working, just assign a StackDistProbe to the
comm monitor, as done in tests/config/tgen-simple-mem.py.
Good luck.
Andreas
Date: Wednesday, 4 November 2015 at 20:23
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
Thanks for your response. Can you please tell me how to instantiate
# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)
# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side
When I tried to run my program I got an error as "fatal: Communication
monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and
what are the other things to be done.
Thanks
On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <
Post by Andreas Hansson
Hi Bhaskar,
There are a few steps you need to take, and it involves a few
- First, the stack distance calculator is a probe, and the output is
in the shape of gem5 stats. Thus, you need to instantiate the probe, and
attach it to a probe point.
- Second, to be able to attach the probe in various locations in the
memory system (core to L1, before the L2, in front of the system memory),
we use a module called a CommMonitor, which has a bunch of generic stats,
but also suitable packet probe points.
Consequently, you need to modify your script that assembles and
configures the system, in your case se.py, and instantiate a CommMonitor,
connect it where you want to monitor the communication, then instantiate a
StackDistProbe and attach it to the monitor you just instantiated. The bad
news is that it involves quite a few steps. The good news is that these are
all things you will need to do as a gem5 user in any case, so better get
used to it :-).
For an example, have a look at one of the regression scripts,
tests/config/tgen-simple-mem.py. This script includes both trace
generation, and calculation of stack distance. Note that you don’t need to
set "verify = True" on the StackDistProbe. If you do you will calculate the
stack distance both using a clever algorithm, and a “naïve” stack which is
a lot slower.
Andreas
Date: Sunday, 1 November 2015 at 22:08
Subject: [gem5-users] How to use stack distance calculator in gem5.
Hi
I am Bhaskar. I am a final year B.E student. For my final year
project I am using the gem5 simulator. I need to collect the stack distance
of programs using gem5. I used the --debug-flag="StackDist", but it did not
print anything. I also tried setting the verifyStack flag in
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
build/X86/gem5.debug --debug-flag='StackDist'
--debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini
--json-config=for.json configs/example/se.py --num-cpus=1
--cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache
--num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"
Can you please guide me through my problem and tell me to do the necessary steps.
Thanks for your support
-Bhaskar
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments
are confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments
are confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Bhaskar Kalita
2016-01-18 14:22:50 UTC
Permalink
Hey Andreas,

Can you help me on this.

Thanks,
Bhaskar
Post by Bhaskar Kalita
Hi Andreas,
I want the values for every specific distance. Can you tell me which files
do I need to change to do so? I require the values in that format to input
it in a scheduling simulator named SimSo in the form of the SDP file of a
task. The simulator takes the values for ever particular distance rather
than in a generalized form. So it will be better if I could get the values
in this format using gem5.
0 .3946537296
1 .1320268926
2 .0680432691
3 .0526663317
4 .0700712422
5 .0308234477
6 .0356989232
7 .0200548268
8 .0118467264
9 .0195609635
10 .0122696827
11 .0052761524
12 .0032688299
13 .0091512174
14 .0038000460
15 .0030201249
16 .0012057944
17 .0034824725
18 .0047665379
In earlier work I have read that this type of SDP was obtained by using
gem5. So if you could tell me where I can make the changes ????
Thanks,
Bhaskar
Post by Andreas Hansson
Hi Bhaskar,
The values refer to stack distances, measures in accesses. Thus, you have
6 requests/packets where the stack distance is between 0 and 127.
I don’t understand why you want them in a separate file. gem5 relies on a
centralised stats.txt, you can change the name, but all the stats will end
up in the same file.
If you want the stack distance for a specific address you will have to
change the source. The probe is intended to scale to large datasets and
long simulation runs, so it needs to handle hundreds of millions of
accesses. I honestly do not understand why you want it per line
but if you
do you will have to hack away.
Andreas
Date: Friday, 18 December 2015 at 17:07
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
Thanks for your help. I am able to obtain the sdp by adding the following
system.monitor = CommMonitor()
system.monitor.trace = MemTraceProbe(trace_file = "monitor.ptrc.gz")
system.monitor.stackdist = StackDistProbe( disable_log_hists = True )
system.l2.cpu_side = system.monitor.master
system.monitor.slave = system.tol2bus.master
#system.l2.cpu_side = system.tol2bus.master
system.l2.mem_side = system.membus.slave
The sdp is obtained in the stats,txt file. And the values are generalized
system.monitor.stack_dist_calc.readLinearHist::0-127 6
12.24% 12.24% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::128-255 8
16.33% 28.57% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::256-383 4
8.16% 36.73% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::384-511 0
0.00% 36.73% # Reads linear distribution
Do the numbers 0-127 refer to the cache lines???
Is their a way to print this value in a separate file???
How can I find the values for every distinct lines???
Post by Andreas Hansson
Hi Bhaskar,
Have you sorted out your issues? I just tried adding these lines to the
gem5 trunk (not the gem5-stable repo) and it does the job for the
regression scripts. The se.py and fs.py scripts don’t call this function in
BaseCPU (unfortunately we do things differently in different scripts), so
for these you have to do the corresponding changes in
configs/common/CacheConfig where the l2 is added.
Also, be mindful of the indentation in Python files.
Andreas
Date: Wednesday, 11 November 2015 at 10:36
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas;
I installed pydot. Now am more clear with the topology. I want to put
#self.toL2Bus.master = self.l2cache.cpu_side
self.monitor = CommMonitor()
self.monitor.StackDist = StackDistProbe(verify = True)
self.toL2Bus.master = self.monitor.slave
self.monitor.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
fatal: system.monitor.stackdist without default or user set value
And I also cannot see the CommMonitor anywhere in the in the dot files.
Do I also need to make change in se.py and CommMonitor.py??? I have
attached the three files for reference.
Thanks,
Bhaskar
On Sun, Nov 8, 2015 at 10:34 PM, Andreas Hansson <
Post by Andreas Hansson
Hi Bhaskar,
Something is not quite right in the topology you are expressing in
these lines. Have you looked at the graphical output (make sure you have
py-dot installed)?
You want to trace _after_ the l2? If so, I would suggest to connect the
self.monitor = CommMonitor()
self.monitor.slave = self.l2cache.mem_side
self._cached_ports = [‘monitor.master’]
This will leave the CommMonitor as the “exposed” port being connected
downwards.
Make sure this is all working before you start fiddling with the
probes. The graphical output is your friend

self.monitor.sdprobe = StackDistProbe()
Andreas
Date: Sunday, 8 November 2015 at 12:16
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
You did not respond to my previous mail, hope you reply to this. I went
through the mail archive regarding CommMonitor. I tried again changing
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side
fatal: system.monitor.stackdist without default or user set value
build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt
--dump-config=hello.ini --json-config=hello.json configs/example/se.py
--num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB
--l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c
'tests/test-progs/hello/bin/x86/linux/hello;'
Can you help me out where am making the mistake.
Thanks,
Bhaskar
Post by Bhaskar Kalita
Hi Andreas
I want to measure the stack distance for l2 cache. So, tried to place
the CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py
#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
stackdist = Param.StackDistProbe(NULL)
I re-compiled as scons build/X86/gem5.debug. It worked fine. The error
I got while trying to run an example was
File "<string>", line 1, in <module>
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py",
line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py",
line 583, in run
m5.instantiate(checkpoint_dir)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py",
line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1453, in createCCObject
self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py",
line 248, in getValue
return [ v.getValue() for v in self ]
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration hierarchy.
Can you please explain if I need to modify se.py for my purpose?
Please help me out through this as I am very new to gem5.
Thanks
Bhaskar
On Thu, Nov 5, 2015 at 1:50 PM, Andreas Hansson <
Post by Andreas Hansson
Hi Bhaskar,
Have a look at tests/config/tgen-simple-mem.py.
The comm monitor has a master and a slave port, and you need to
connect it “between” two other modules. There are plenty examples on the
mailing list for adding it between the L1 and L2, for example by changing
BaseCpu.py (if you do, remember to recompile). Once you have instantiated
the comm monitor, and connected it, run an experiment and make sure you get
the stats in the stats.txt output. Also, if you install pydot, you can see
the system topology in m5out/config.dot.pdf or config.dot.svg (the latter
even has mouseover tooltips etc).
When the things above are working, just assign a StackDistProbe to
the comm monitor, as done in tests/config/tgen-simple-mem.py.
Good luck.
Andreas
Date: Wednesday, 4 November 2015 at 20:23
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
Hi Andreas,
Thanks for your response. Can you please tell me how to instantiate
# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)
# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side
Communication monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and
what are the other things to be done.
Thanks
On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <
Post by Andreas Hansson
Hi Bhaskar,
There are a few steps you need to take, and it involves a few
- First, the stack distance calculator is a probe, and the output is
in the shape of gem5 stats. Thus, you need to instantiate the probe, and
attach it to a probe point.
- Second, to be able to attach the probe in various locations in the
memory system (core to L1, before the L2, in front of the system memory),
we use a module called a CommMonitor, which has a bunch of generic stats,
but also suitable packet probe points.
Consequently, you need to modify your script that assembles and
configures the system, in your case se.py, and instantiate a CommMonitor,
connect it where you want to monitor the communication, then instantiate a
StackDistProbe and attach it to the monitor you just instantiated. The bad
news is that it involves quite a few steps. The good news is that these are
all things you will need to do as a gem5 user in any case, so better get
used to it :-).
For an example, have a look at one of the regression scripts,
tests/config/tgen-simple-mem.py. This script includes both trace
generation, and calculation of stack distance. Note that you don’t need to
set "verify = True" on the StackDistProbe. If you do you will calculate the
stack distance both using a clever algorithm, and a “naïve” stack which is
a lot slower.
Andreas
Date: Sunday, 1 November 2015 at 22:08
Subject: [gem5-users] How to use stack distance calculator in gem5.
Hi
I am Bhaskar. I am a final year B.E student. For my final year
project I am using the gem5 simulator. I need to collect the stack distance
of programs using gem5. I used the --debug-flag="StackDist", but it did not
print anything. I also tried setting the verifyStack flag in
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
build/X86/gem5.debug --debug-flag='StackDist'
--debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini
--json-config=for.json configs/example/se.py --num-cpus=1
--cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache
--num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"
Can you please guide me through my problem and tell me to do the
necessary steps.
Thanks for your support
-Bhaskar
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments
are confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments
are confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
------------------------------
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium. Thank you.
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Andreas Hansson
2016-01-18 16:11:41 UTC
Permalink
Hi Bhaskar,

I am afraid I do not understand what you are after. The stack distance probe is outputting a good-old conventional stack distance histogram, and if you want to change it you must just go ahead.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Monday, 18 January 2016 at 14:22
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hey Andreas,

Can you help me on this.

Thanks,
Bhaskar

On Wed, Jan 13, 2016 at 6:37 PM, Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi Andreas,

I want the values for every specific distance. Can you tell me which files do I need to change to do so? I require the values in that format to input it in a scheduling simulator named SimSo in the form of the SDP file of a task. The simulator takes the values for ever particular distance rather than in a generalized form. So it will be better if I could get the values in this format using gem5.


0 .3946537296
1 .1320268926
2 .0680432691
3 .0526663317
4 .0700712422
5 .0308234477
6 .0356989232
7 .0200548268
8 .0118467264
9 .0195609635
10 .0122696827
11 .0052761524
12 .0032688299
13 .0091512174
14 .0038000460
15 .0030201249
16 .0012057944
17 .0034824725
18 .0047665379

In earlier work I have read that this type of SDP was obtained by using gem5. So if you could tell me where I can make the changes ????

Thanks,
Bhaskar

On Sat, Dec 19, 2015 at 3:49 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

The values refer to stack distances, measures in accesses. Thus, you have 6 requests/packets where the stack distance is between 0 and 127.

I don’t understand why you want them in a separate file. gem5 relies on a centralised stats.txt, you can change the name, but all the stats will end up in the same file.

If you want the stack distance for a specific address you will have to change the source. The probe is intended to scale to large datasets and long simulation runs, so it needs to handle hundreds of millions of accesses. I honestly do not understand why you want it per line
but if you do you will have to hack away.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Friday, 18 December 2015 at 17:07

To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

Thanks for your help. I am able to obtain the sdp by adding the following lines in CacheConfig.py:

system.monitor = CommMonitor()
system.monitor.trace = MemTraceProbe(trace_file = "monitor.ptrc.gz")
system.monitor.stackdist = StackDistProbe( disable_log_hists = True )
system.l2.cpu_side = system.monitor.master
system.monitor.slave = system.tol2bus.master
#system.l2.cpu_side = system.tol2bus.master
system.l2.mem_side = system.membus.slave

The sdp is obtained in the stats,txt file. And the values are generalized in a range like:

system.monitor.stack_dist_calc.readLinearHist::0-127 6 12.24% 12.24% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::128-255 8 16.33% 28.57% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::256-383 4 8.16% 36.73% # Reads linear distribution
system.monitor.stack_dist_calc.readLinearHist::384-511 0 0.00% 36.73% # Reads linear distribution

Do the numbers 0-127 refer to the cache lines???
Is their a way to print this value in a separate file???
How can I find the values for every distinct lines???



On Fri, Nov 13, 2015 at 3:46 AM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Have you sorted out your issues? I just tried adding these lines to the gem5 trunk (not the gem5-stable repo) and it does the job for the regression scripts. The se.py and fs.py scripts don’t call this function in BaseCPU (unfortunately we do things differently in different scripts), so for these you have to do the corresponding changes in configs/common/CacheConfig where the l2 is added.

Also, be mindful of the indentation in Python files.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Wednesday, 11 November 2015 at 10:36

To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas;

I installed pydot. Now am more clear with the topology. I want to put the monitor "before L2". So, tried changing BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
self.monitor = CommMonitor()
self.monitor.StackDist = StackDistProbe(verify = True)
self.toL2Bus.master = self.monitor.slave
self.monitor.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I recompiled and and trier to run an example and received error as:

fatal: system.monitor.stackdist without default or user set value

And I also cannot see the CommMonitor anywhere in the in the dot files.

Do I also need to make change in se.py and CommMonitor.py??? I have attached the three files for reference.

Thanks,

Bhaskar







On Sun, Nov 8, 2015 at 10:34 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Something is not quite right in the topology you are expressing in these lines. Have you looked at the graphical output (make sure you have py-dot installed)?

You want to trace _after_ the l2? If so, I would suggest to connect the L2 cache as usual. Then instantiate and connect the monitor:

self.monitor = CommMonitor()
self.monitor.slave = self.l2cache.mem_side
self._cached_ports = [‘monitor.master’]

This will leave the CommMonitor as the “exposed” port being connected downwards.

Make sure this is all working before you start fiddling with the probes. The graphical output is your friend


Once the above is working, it should just be a matter of adding a line:

self.monitor.sdprobe = StackDistProbe()

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 8 November 2015 at 12:16

To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

You did not respond to my previous mail, hope you reply to this. I went through the mail archive regarding CommMonitor. I tried again changing BaseCPU.py as:

self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
self.monitor = CommMonitor()
self.monitor.stackdist = StackDistProbe(verify = True)
self.l2cache.cpu_side = self.monitor.master
self.monitor.slave = self.l2cache.mem_side

I re-compiled and tried to run an example but received the following error:

fatal: system.monitor.stackdist without default or user set value

For reference my command line was:

build/X86/gem5.debug --debug-flag=StackDist --stats-file=hello.txt --dump-config=hello.ini --json-config=hello.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c 'tests/test-progs/hello/bin/x86/linux/hello;'

Can you help me out where am making the mistake.

Thanks,
Bhaskar





On Fri, Nov 6, 2015 at 5:03 AM, Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi Andreas

I want to measure the stack distance for l2 cache. So, tried to place the CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py as:

#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

I tried assigning a StackDistProbe to the comm monitor as:

stackdist = Param.StackDistProbe(NULL)

I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I got while trying to run an example was

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py", line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py", line 583, in run
m5.instantiate(checkpoint_dir)
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py", line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1453, in createCCObject
self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1435, in getCCObject
params = self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py", line 248, in getValue
return [ v.getValue() for v in self ]
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1435, in getCCObject
params = self.getCCParams()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1400, in getCCParams
value = value.getValue()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1457, in getValue
return self.getCCObject()
File "/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py", line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration hierarchy.


Can you please explain if I need to modify se.py for my purpose? Please help me out through this as I am very new to gem5.


Thanks

Bhaskar





On Thu, Nov 5, 2015 at 1:50 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

Have a look at tests/config/tgen-simple-mem.py.

The comm monitor has a master and a slave port, and you need to connect it “between” two other modules. There are plenty examples on the mailing list for adding it between the L1 and L2, for example by changing BaseCpu.py (if you do, remember to recompile). Once you have instantiated the comm monitor, and connected it, run an experiment and make sure you get the stats in the stats.txt output. Also, if you install pydot, you can see the system topology in m5out/config.dot.pdf or config.dot.svg (the latter even has mouseover tooltips etc).

When the things above are working, just assign a StackDistProbe to the comm monitor, as done in tests/config/tgen-simple-mem.py.

Good luck.

Andreas

From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Wednesday, 4 November 2015 at 20:23
To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: Re: [gem5-users] How to use stack distance calculator in gem5.

Hi Andreas,

Thanks for your response. Can you please tell me how to instantiate the probe. I tried modifying the se.py file as:

# Create a separate clock domain for the CPUs
system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
voltage_domain =
system.cpu_voltage_domain)

# to calculate stack distance
system.monitor = CommMonitor()
system.monitor.stackdist = StackDistProbe(verify = True)


And also changed BaseCPU.py as:

def addTwoLevelCacheHierarchy(self, ic, dc, l2c, iwc = None, dwc = None):
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
self.toL2Bus = L2XBar()
self.connectCachedPorts(self.toL2Bus)
self.l2cache = l2c
self.toL2Bus.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']

# to calculate stack distance
self.l2MONITOR = StackDistProbe(verify = True)
self._cached_ports = self.l2MONITOR.slave
self.l2MONITOR.master = l2cache.mem_side

When I tried to run my program I got an error as "fatal: Communication monitor is not connected on both sides."
Can you please tell me if I am approaching in the right direction and what are the other things to be done.

Thanks



On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <***@arm.com<mailto:***@arm.com>> wrote:
Hi Bhaskar,

There are a few steps you need to take, and it involves a few widely-adopted gem5 concepts:

- First, the stack distance calculator is a probe, and the output is in the shape of gem5 stats. Thus, you need to instantiate the probe, and attach it to a probe point.

- Second, to be able to attach the probe in various locations in the memory system (core to L1, before the L2, in front of the system memory), we use a module called a CommMonitor, which has a bunch of generic stats, but also suitable packet probe points.

Consequently, you need to modify your script that assembles and configures the system, in your case se.py, and instantiate a CommMonitor, connect it where you want to monitor the communication, then instantiate a StackDistProbe and attach it to the monitor you just instantiated. The bad news is that it involves quite a few steps. The good news is that these are all things you will need to do as a gem5 user in any case, so better get used to it :-).

For an example, have a look at one of the regression scripts, tests/config/tgen-simple-mem.py. This script includes both trace generation, and calculation of stack distance. Note that you don’t need to set "verify = True" on the StackDistProbe. If you do you will calculate the stack distance both using a clever algorithm, and a “naïve” stack which is a lot slower.

Andreas


From: gem5-users <gem5-users-***@gem5.org<mailto:gem5-users-***@gem5.org>> on behalf of Bhaskar Kalita <***@gmail.com<mailto:***@gmail.com>>
Reply-To: gem5 users mailing list <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Date: Sunday, 1 November 2015 at 22:08
To: "gem5-***@gem5.org<mailto:gem5-***@gem5.org>" <gem5-***@gem5.org<mailto:gem5-***@gem5.org>>
Subject: [gem5-users] How to use stack distance calculator in gem5.


Hi
I am Bhaskar. I am a final year B.E student. For my final year project I am using the gem5 simulator. I need to collect the stack distance of programs using gem5. I used the --debug-flag="StackDist", but it did not print anything. I also tried setting the verifyStack flag in mem/stack_dist_calc.hh to true as:
// Flag to enable verification of stack. (Slows down the simulation)
const bool verifyStack=true;
but it did not work too. For reference this is the command line am usuing:
build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz' --stats-file=forij.txt --dump-config=for.ini --json-config=for.json configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB --l2_assoc=4 -c "bench/x86/forij;"

Can you please guide me through my problem and tell me to do the necessary steps.

Thanks for your support

-Bhaskar



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users



________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


________________________________

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

_______________________________________________
gem5-users mailing list
gem5-***@gem5.org<mailto:gem5-***@gem5.org>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Loading...