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 <[email protected]>
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 <[email protected]> on behalf of Bhaskar
> Kalita <[email protected]>
> Reply-To: gem5 users mailing list <[email protected]>
> Date: Wednesday, 11 November 2015 at 10:36
>
> To: gem5 users mailing list <[email protected]>
> 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 <[email protected]>
> 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 <[email protected]> on behalf of Bhaskar
>> Kalita <[email protected]>
>> Reply-To: gem5 users mailing list <[email protected]>
>> Date: Sunday, 8 November 2015 at 12:16
>>
>> To: gem5 users mailing list <[email protected]>
>> 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 <[email protected]>
>> 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 <[email protected]
>>> > 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 <[email protected]> on behalf of Bhaskar
>>>> Kalita <[email protected]>
>>>> Reply-To: gem5 users mailing list <[email protected]>
>>>> Date: Wednesday, 4 November 2015 at 20:23
>>>> To: gem5 users mailing list <[email protected]>
>>>> 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 <
>>>> [email protected]> 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 <[email protected]> on behalf of Bhaskar
>>>>> Kalita <[email protected]>
>>>>> Reply-To: gem5 users mailing list <[email protected]>
>>>>> Date: Sunday, 1 November 2015 at 22:08
>>>>> To: "[email protected]" <[email protected]>
>>>>> 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
>>>>> [email protected]
>>>>> 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
>>>> [email protected]
>>>> 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
>> [email protected]
>> 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
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users