[gem5-users] Re: [EXT] Re: Problems upgrading to latest version

2023-07-24 Thread Beser, Nicholas D. via gem5-users
Bobby,

You suggestion (number 3) worked, and I was able to run the compiled gem5.opt 
by fixing generator=generator. I did have an additional error which I corrected 
by:

motherboard._pre_instantiate()
m5.instantiate()

I am including the two runs (with error and no error). I have a couple of 
concerns. I used the docker commands in gem5-bootcamp-env to build a docker 
container that I used to run gem5. This seems to run in both WSL, and on my 
stand alone Ubuntu linux system. When I run via the docker I am root, so there 
may be some issues with root privilege.

I don’t have a problem running version 22 in my class, but I am concerned that 
I don’t control that repository. I need to make sure that repository will 
remain stable while I teach with that version. If I have enough time to 
prepared, I will also see if I can get it running on the jetson orin nano 
system since we are providing them to our students.

I think I disagree with statement 2. The build was following the example from 
Marjan Fariborz Cache Systems charts. I was in the gem5 directory (under the 
gem5-bootcamp-env directory). The argument –j16 indicates use all 16 cores.  I 
am not sure why the statement:

scons build/NULL_MESI_Two_Level/gem5.opt --default=NULL PROTOCOL=MESI_Two_Level 
–j16

Produces the error message:
Error: No non-leaf 'build' dir found on target path. 
/home/besernd1/gem5-bootcamp-env/gem5/–j16

If I use:
python3 `which scons` build/NULL_MESI_Two_Level/gem5.opt --default=NULL 
PROTOCOL=MESI_Two_Level -j16

Everything works correctly.

Thank-you for your help,

Nick

Prior to the correction this is the error message:


./gem5/build/NULL_MESI_Two_Level/gem5.opt 
materials/using-gem5/04-cache-models/simple_cache_run.py 2 MESITwoLevel 512MB
gem5 Simulator System.  https://www.gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 version 23.0.0.1
gem5 compiled Jul 24 2023 20:02:58
gem5 started Jul 24 2023 20:15:44
gem5 executing on BESERND1-WL2, pid 11874
command line: ./gem5/build/NULL_MESI_Two_Level/gem5.opt 
materials/using-gem5/04-cache-models/simple_cache_run.py 2 MESITwoLevel 512MB

Global frequency set at 1 ticks per second
warn: No dot file generated. Please install pydot to generate the dot file and 
pdf.
Exception:
AbstractBoard's `_connect_things` function has not been called. This is likely
due to not running a board outside of the gem5 Standard Library Simulator
module. If this is the case, this can be resolved by calling
`._pre_instantiate()` prior to `m5.instantiate()`.


At:
  src/python/gem5/components/boards/abstract_board.py(402): 
_connect_things_check
  src/python/gem5/components/boards/abstract_system_board.py(65): createCCObject
  src/python/m5/simulate.py(124): instantiate
  materials/using-gem5/04-cache-models/simple_cache_run.py(104): 
  src/python/m5/main.py(629): main

After the correction I got:

:~/gem5-bootcamp-env$ ./gem5/build/NULL_MESI_Two_Level/gem5.opt 
materials/using-gem5/04-cache-models/simple_cache_run.py 2 MESITwoLevel 512MB
gem5 Simulator System.  https://www.gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 version 23.0.0.1
gem5 compiled Jul 24 2023 20:02:58
gem5 started Jul 24 2023 20:18:09
gem5 executing on BESERND1-WL2, pid 11886
command line: ./gem5/build/NULL_MESI_Two_Level/gem5.opt 
materials/using-gem5/04-cache-models/simple_cache_run.py 2 MESITwoLevel 512MB

Global frequency set at 1 ticks per second
warn: No dot file generated. Please install pydot to generate the dot file and 
pdf.
src/mem/dram_interface.cc:690: warn: DRAM device capacity (8192 Mbytes) does 
not match the address range assigned (512 Mbytes)
src/base/statistics.hh:279: warn: One of the stats is a legacy stat. Legacy 
stat is a stat that does not belong to any statistics::Group. Legacy stat is 
deprecated.
Beginning simulation!
src/sim/simulate.cc:194: info: Entering event queue @ 0.  Starting simulation...
src/mem/ruby/system/Sequencer.cc:606: warn: Replacement policy updates recently 
became the responsibility of SLICC state machines. Make sure to setMRU() near 
callbacks in .sm files!
Exiting @ tick 250002414 because system.processor.cores1.generator has 
encountered the exit state and will terminate the simulation.
.


From: Bobby Bruce 
Sent: Monday, July 24, 2023 2:45 PM
To: The gem5 Users mailing list ; Beser, Nicholas D. 

Subject: [EXT] Re: [gem5-users] Problems upgrading to latest version

APL external email warning: Verify sender 
bbr...@ucdavis.edu before clicking links or 
attachments



I think there are a few things going on here causing problems.

1. The pre-commit hooks aren't being installed correctly. i think this is due 
to some directory permission error. The '/.cache' directory appears to not have 
the right permissions here. Perhaps this you did something here with sudo? You 
can recreate this error using "/util/pre-commit-install.sh". Either way it 
isn't 

[gem5-users] Re: Problems upgrading to latest version

2023-07-24 Thread Bobby Bruce via gem5-users
I think there are a few things going on here causing problems.

1. The pre-commit hooks aren't being installed correctly. i think this is due 
to some directory permission error. The '/.cache' directory appears to not have 
the right permissions here. Perhaps this you did something here with sudo? You 
can recreate this error using "/util/pre-commit-install.sh". Either way it 
isn't necessary that these hooks are installed. If this step fails gem5 should 
still work.

2. The "error not "build' dir found on target path": I'm pretty sure you either 
didn't execute the this in the root of the gem5 directory or you made a typo 
when typing the scons command. The "-j16" at the end of that command makes me 
believe there was some kind of error with passing the `-j` flag and specifying 
the build path.

3. The "procesor" argument has been renamed to "generator" for the test board. 
I believe this is easily fixed. All you need to do is change 
https://github.com/gem5bootcamp/gem5-bootcamp-env/blob/1afde18b5c4240736507a68fd2e54351be31f30d/materials/using-gem5/04-cache-models/simple_cache_run.py#L98
 to `generator=generator,`. 

It should be noted that the 2022 gem5 was build with v22.0 of gem5. If you're 
following the Bootcamp we strongly advise using v22.0 of gem5. There have been 
numerous codebase updates over the past year and we can't guarantee all of the 
tutorials will work as intended with the latest version.

--
Dr. Bobby R. Bruce
Room 3050,
Kemper Hall, UC Davis
Davis,
CA, 95616
 
web: https://www.bobbybruce.net

> On Jul 23, 2023, at 7:00 AM, Beser, Nicholas D. via gem5-users 
>  wrote:
> 
> I had been running version 22, and I had also run the bootcamp 2022 example 
> for demonstrating MESI_Two_Level protocol. After I upgraded to version 
> 23.0.0.1, I first noticed that I had trouble compiling the example. After 
> finding a work around, to generate gem5.opt, The program seems to be missing 
> the parameter processor (which was not needed when I ran version 22. I can 
> use some suggestions on how to run this example with the new version (What 
> has changed?
>  
> The example where it worked in version 22, but not in version 23:
>  
> scons build/NULL_MESI_Two_Level/gem5.opt --default=NULL 
> PROTOCOL=MESI_Two_Level –j16
>  
> The program gave me an error: 
>  
> scons build/NULL_MESI_Two_Level/gem5.opt --default=NULL 
> PROTOCOL=MESI_Two_Level –j16
> scons: Reading SConscript files ...
>  
> You're missing the pre-commit/commit-msg hooks. These hook help to ensure your
> code follows gem5's style rules on git commit and your commit messages follow
> our commit message requirements. This script will now install these hooks in
> your .git/hooks/ directory.
> Press enter to continue, or ctrl-c to abort:
> An unexpected error has occurred: PermissionError: [Errno 13] Permission 
> denied: '/.cache'
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.8/dist-packages/pre_commit/error_handler.py", 
> line 73, in error_handler
> yield
>   File "/usr/local/lib/python3.8/dist-packages/pre_commit/main.py", line 367, 
> in main
> store = Store()
>   File "/usr/local/lib/python3.8/dist-packages/pre_commit/store.py", line 71, 
> in __init__
> os.makedirs(self.directory, exist_ok=True)
>   File "/usr/lib/python3.8/os.py", line 213, in makedirs
> makedirs(head, exist_ok=exist_ok)
>   File "/usr/lib/python3.8/os.py", line 223, in makedirs
> mkdir(name, mode)
> PermissionError: [Errno 13] Permission denied: '/.cache'
>  
> During handling of the above exception, another exception occurred:
>  
> Traceback (most recent call last):
>   File "/usr/local/bin/pre-commit", line 8, in 
> sys.exit(main())
>   File "/usr/local/lib/python3.8/dist-packages/pre_commit/main.py", line 433, 
> in main
> raise AssertionError(
>   File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
> self.gen.throw(type, value, traceback)
>   File "/usr/local/lib/python3.8/dist-packages/pre_commit/error_handler.py", 
> line 81, in error_handler
> _log_and_exit(msg, ret_code, e, traceback.format_exc())
>   File "/usr/local/lib/python3.8/dist-packages/pre_commit/error_handler.py", 
> line 31, in _log_and_exit
> storedir = Store().directory
>   File "/usr/local/lib/python3.8/dist-packages/pre_commit/store.py", line 71, 
> in __init__
> os.makedirs(self.directory, exist_ok=True)
>   File "/usr/lib/python3.8/os.py", line 213, in makedirs
> makedirs(head, exist_ok=exist_ok)
>   File "/usr/lib/python3.8/os.py", line 223, in makedirs
> mkdir(name, mode)
> PermissionError: [Errno 13] Permission denied: '/.cache'
> It is strongly recommended you install the pre-commit hooks before working 
> with gem5. Do you want to continue compilation (y/n)?
> y
> Error: No non-leaf 'build' dir found on target path. 
> /home/nbeser1/gem5-bootcamp-env/gem5/–j16
>  
> However if I run the following:
>  
> python3 `which scons` build/NULL_MESI_Two_Level/gem5.opt --default=NULL 
> 

[gem5-users] Re: potential error in gem5 simulation?

2023-07-24 Thread Jason Lowe-Power via gem5-users
There's a lot of information missing in your email, but I'll make some
guesses and try to help.

If you're using x86 and you compiled lbm on your host, then most likely it
is using SSE/AVX/vector instructions that may not be implemented or
implemented incorrectly in gem5. I would expect to see warnings about
unimplemented instructions, but I don't see them in your output.

One possible way to check is to recompile without vector instructions and
try that binary.

Finally, there are a number of warnings about unimplemented syscalls. I
don't think any of those would cause a problem, but using FS mode could
improve the fidelity of your simulation.

Cheers,
Jason

On Sat, Jul 22, 2023 at 5:59 AM An Chow Lai via gem5-users <
gem5-users@gem5.org> wrote:

> To whom it may concern,
>
> I'm new to gem5, I just downloaded gem5 to simulate some spec benchmarks,
> but I encountered something which seems not making sense;
> basically, the outcome of the program simulated by gem5 does not match the
> outcome of the same program run directly on the machine. The results of two
> runs are shown below.
> I hope I can get help/corrections from you guys. Thank you.
>
> Sincerely yours,
> An-Chow
>
> direct run (which is expected and looks correct to me):
> -
> ../../exe/lbm_r_base.mytest-m64 30 reference.dat 0 0 100_100_130_ldc.of
> MAIN_printInfo:
>grid size  : 100 x 100 x 130 = 1.30 * 10^6 Cells
>nTimeSteps : 30
>result file: reference.dat
>action : nothing
>simulation type: lid-driven cavity
>obstacle file  : 100_100_130_ldc.of
>
> LBM_showGridStatistics:
>nObstacleCells:  112539 nAccelCells:   18432 nFluidCells: 1169029
>minRho: 1.00 maxRho: 1.00 Mass: 1.30e+06
>minU  : 0.00 maxU  : 0.00
>
> LBM_showGridStatistics:
>nObstacleCells:  112539 nAccelCells:   18432 nFluidCells: 1169029
>minRho: 0.998947 maxRho: 1.001139 Mass: 1.30e+06
>minU  : 0.00 maxU  : 0.003548
>
> gem5 simulated run (which does not match the direct run above):
> --
> ~/Work/gem5/build/X86/gem5.opt
> ~/Work/gem5/configs/deprecated/example/se.py
> --cmd="../../exe/lbm_r_base.mytest-m64" --option="30  reference.dat 0 0
> 100_100_130_ldc.of" --mem-size=8GB
> gem5 Simulator System.  https://www.gem5.org
> gem5 is copyrighted software; use the --copyright option for details.
>
> gem5 version 23.0.0.1
> gem5 compiled Jul 22 2023 09:57:33
> gem5 started Jul 22 2023 12:50:00
> gem5 executing on Oreo-II, pid 62021
>
> warn: The `get_runtime_isa` function is deprecated. Please migrate away
> from using this function.
> warn: The se.py script is deprecated. It will be removed in future
> releases of  gem5.
> warn: The `get_runtime_isa` function is deprecated. Please migrate away
> from using this function.
> Global frequency set at 1 ticks per second
> warn: No dot file generated. Please install pydot to generate the dot file
> and pdf.
> src/base/statistics.hh:279: warn: One of the stats is a legacy stat.
> Legacy stat is a stat that does not belong to any statistics::Group. Legacy
> stat is deprecated.
> system.remote_gdb: Listening for connections on port 7000
>  REAL SIMULATION 
> src/sim/simulate.cc:194: info: Entering event queue @ 0.  Starting
> simulation...
> src/sim/mem_state.cc:443: info: Increasing stack size by one page.
> src/sim/syscall_emul.cc:74: warn: ignoring syscall set_robust_list(...)
> src/sim/syscall_emul.cc:74: warn: ignoring syscall rseq(...)
> src/sim/syscall_emul.cc:74: warn: ignoring syscall mprotect(...)
> src/sim/syscall_emul.cc:74: warn: ignoring syscall mprotect(...)
> src/sim/syscall_emul.cc:74: warn: ignoring syscall mprotect(...)
> src/sim/syscall_emul.cc:74: warn: ignoring syscall mprotect(...)
> MAIN_printInfo:
>grid size  : 100 x 100 x 130 = 1.30 * 10^6 Cells
>nTimeSteps : 30
>result file: reference.dat
>action : nothing
>simulation type: lid-driven cavity
>obstacle file  : 100_100_130_ldc.of
>
> LBM_showGridStatistics:
>nObstacleCells:  112539 nAccelCells:   18432 nFluidCells: 1169029
>minRho: 0.00 maxRho: 0.00 Mass: 0.00e+00
>minU  : 0.17 maxU  : 0.235702
>
> LBM_showGridStatistics:
>nObstacleCells:  112539 nAccelCells:   18432 nFluidCells: 1169029
>minRho: 0.00 maxRho: 0.00 Mass: 0.00e+00
>minU  : -nan maxU  :  inf
>
> ___
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
>
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: Question about pulling in the latest version of gem5 with the bootcamp 2022 files.

2023-07-24 Thread Jason Lowe-Power via gem5-users
Hi Nick,

You should be able to `cd` to the gem5 directory, set up a remote to the
new github location (`git remote add upstream https://github.com/gem5/gem5`)
then checkout stable (`git checkout upstream/stable`). (Note: commands off
the top of my head and may have mistakes.)

That said, be careful as some of the python/stdlib APIs will have changed.
So, some of the examples may need to be updated.

Cheers,
Jason

On Sat, Jul 22, 2023 at 12:55 PM Beser, Nicholas D. via gem5-users <
gem5-users@gem5.org> wrote:

> I am using the bootcamp examples to teach my computer architecture class
> about gem5. I would like to pull in the latest version of gem5 from the
> github location. The command I am using is:
>
>
>
> git clone --recursive
> https://github.com/gem5bootcamp/gem5-bootcamp-env.git
>
>
>
> When I compile gem5, Instead of version 23, I am getting gem5 version
> 22.0.0.0. Is there a recommended way of getting the latest version?
>
>
>
> Nick
> ___
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
>
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: Is there any ways for the guest program to communicate with the GEM5 simulator?

2023-07-24 Thread Richard Cooper via gem5-users
Hello,

You can use the special "m5ops" instructions to communicate between your 
workload and the simulator. The documentation is here:
https://www.gem5.org/documentation/general_docs/m5ops/

The available instructions are listed here, and you can build these wrapper 
functions into a library to link to your code (see documentation above).
https://github.com/gem5/gem5/blob/stable/include/gem5/m5ops.h

The simplest option would be to use the `m5_dump_reset_stats()` to dump and 
reset the statistics between the different phases of your program, but you can 
also use m5ops to mark regions of interest, or even to drop back into the 
Python configuration script to take more complex action.

Hope this helps,

Best regards,
Richard.



-Original Message-
From: Foobat via gem5-users 
Sent: Saturday, July 22, 2023 9:39 AM
To: gem5-users@gem5.org
Cc: Foobat 
Subject: [gem5-users] Is there any ways for the guest program to communicate 
with the GEM5 simulator?

I’m profiling an JIT compiler with GEM5 syscall emulation mode. The lifecycle 
of the JIT compiler has several phases: parsing the code, compiling the code, 
setting up runtime environment, running the compiled code, and cleaning up. I 
need to know the cost and some performance statistics of each phase, to find 
out which part needs more optimization. So the guest program need to tell the 
simulator, for example, “I have set up the runtime environment and I’m about to 
run the code”. Dose gem5 provide any ways to do this? Can the guest program 
communicate with the simulator by executing a special instruction, writing to a 
special memory address, or making a special syscall?
___
gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to 
gem5-users-le...@gem5.org
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-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org