From 03e27090a34974f6054b78441f6b9918bbf0f083 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Fri, 3 Jul 2020 10:28:06 +0200 Subject: [PATCH] Updates gem5 readme. --- DRAMSys/gem5/README.md | 266 +++++++---------------------------------- README.md | 11 +- 2 files changed, 48 insertions(+), 229 deletions(-) diff --git a/DRAMSys/gem5/README.md b/DRAMSys/gem5/README.md index 4d2e1c1a..64137c83 100644 --- a/DRAMSys/gem5/README.md +++ b/DRAMSys/gem5/README.md @@ -1,62 +1,21 @@ ## DRAMSys with gem5 -Install gem5 by following the instructions on the [gem5 wiki](http://gem5.org/Documentation#Getting_Started). -Optionally, use the scripts from [gem5.TnT] to install gem5, build it, get some benchmark programs and learn more about gem5. +Install gem5 by following the instructions in the [gem5 documentation](http://learning.gem5.org/book/part1/index.html). In order to allow a coupling without getting errors we recommend to use **commit a470ef5**. Optionally, use the scripts from [gem5.TnT] to install gem5, build it, get some benchmark programs and learn more about gem5. -In order to understand the SystemC coupling with gem5 it is recommended to -read the documentation in the gem5 repository *util/tlm/README* and [1]. +In order to understand the SystemC coupling with gem5 it is recommended to read the documentation in the gem5 repository *util/tlm/README* and [1]. The main steps for building gem5 and libgem5 follow: ```bash scons build/ARM/gem5.opt -``` - -```bash scons --with-cxx-config --without-python --without-tcmalloc build/ARM/libgem5_opt.so ``` -For MacOS: +In order to use gem5 with DRAMSys export the `GEM5` environment variable (gem5 root directory) and add the path of the library to `LD_LIBRARY_PATH`, then rerun CMake and rebuild the DRAMSys project. -```bash -scons --with-cxx-config --without-python --without-tcmalloc build/ARM/libgem5_opt.dylib -``` +Before you can run gem5 with DRAMSys it is mandatory to run gem5 first without DRAMSys and generate a configuration file *config.ini*, which will be the value of the second parameter passed to DRAMSys_gem5. -In order to use gem5 with DRAMSys set the **GEM5** environment variable to the -path to gem5, for example in the *QtCreator under Projects > Build -& Run > Build Environment*: - -``` -GEM5=/path/to/gem5/ -``` - -Example: - -``` -GEM5=$HOME/gem5_tnt/gem5 -``` - -Optionally, export environment variables in your **~/.bashrc** file or -equivalent and open a new terminal: - -```bash -# In this example gem5 is located at $HOME/gem5_tnt/gem5. -export GEM5=$HOME/gem5_tnt/gem5 - -# Add the folder containing libgem5_opt.so to the list where libraries should -# be searched for. -export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GEM5}/build/ARM -``` - -The project file [DRAMSys.pro](DRAMSys/DRAMSys.pro) checks whether the -environment variable **GEM5** is defined or not and configures automatically -the corresponding build target **gem5** for QtCreator. - -In order to run gem5 with DRAMSys it is mandatory to run gem5 first without -DRAMSys and generate a configuration file **config.ini** which will be the -value of the second parameter passed to DRAMSys_gem5. - -### DRAMSys with gem5 traffic generator +### DRAMSys with gem5 Traffic Generator In the following we will run a simple example with a gem5 traffic generator: @@ -78,12 +37,10 @@ Base System Architecture: ``` -As mentioned before we first need to create a config.ini -that represents the gem5 configuration. We do so by starting gem5 with the -desired python configuration script. +As mentioned before we first need to create a *config.ini* that represents the gem5 configuration. We do so by starting gem5 with the desired python configuration script. ```bash -cd gem5/utils/tlm/ +cd gem5/util/tlm/ ../../build/ARM/gem5.opt conf/tlm_slave.py ``` @@ -92,16 +49,10 @@ cd gem5/utils/tlm/ "fatal: Can't find port handler type 'tlm_slave'" ``` -The configuration file config.ini will be stored in the **m5out** directory. -Copy this configuration file to the building directory of DRAMSys where the -executable **DRAMSys_gem5** is located: +The configuration file *config.ini* will be stored in the *m5out* directory. Copy this configuration file to the building directory of DRAMSys where the +executable *DRAMSys_gem5* is located (*DRAMSys/build/gem5*). -``` -dram.sys/build-DRAMSys-Desktop_Qt_5_7_0_clang_64bit-Debug/gem5 -``` - -Also the traffic generatior configuration file (conf/tgen.cfg) must be stored -in a conf directory of this building directory. +Also the traffic generatior configuration file (*conf/tgen.cfg*) must be stored in a conf directory of this building directory (*DRAMSys/build/gem5/conf*). Then the simulation can be started with: @@ -109,11 +60,9 @@ Then the simulation can be started with: ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/ddr3-example.json config.ini 1 ``` -Let the simulation run for some seconds and then stop it with **CTRL-C**. -Observe the output of the simulation in the trace analyzer. The trace database -can be found inside the gem5 directory in the building directory. +Let the simulation run for some seconds and then stop it with **CTRL-C**. Observe the output of the simulation in the Trace Analyzer. The trace database can be found in *DRAMSys/build/gem5*. -### Gem5 SE mode and DRAMSys +### gem5 SE mode and DRAMSys All essential files for some functional examples are provided. @@ -135,13 +84,9 @@ Execute applications: ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/ddr3-gem5-se.json ../../DRAMSys/gem5/gem5_se/Bubblesort/config.ini 1 ``` -Wait some minutes for the application to finish. +Wait some minutes for the application to finish. The hello application binary was copied from gem5 repository. Other applications were obtained with [gem5.TnT]. -The hello application binary was copied from gem5 repository. - -Other applications were obtained with [gem5.TnT]. - -Command template for generating **.ini** configuration files follows: +Command template for generating *.ini* configuration files follows: ```bash build/ARM/gem5.opt configs/example/se.py \ @@ -155,10 +100,9 @@ An overview of the architcture being simulated is presented below: ![arch](images/gem5_se_mode_arch.png) -**Note**: this is a gem5 generated file, therefore DRAMSys is omitted. DRAMSys is -direct connected as external tlm slave. +**Note**: This is a gem5 generated file, therefore DRAMSys is omitted. DRAMSys is directly connected as an external TLM slave. -**Note**: workaround in se.py required: +**Note**: Workaround in se.py required: ```python ... @@ -168,25 +112,18 @@ MemConfig.config_mem(options, system) ... ``` -A convenience script to execute several applications automatically -[**run.sh**](DRAMSys/gem5/gem5_se/run.sh) is provided . Take a look and learn -from it. +A convenience script to execute several applications automatically [run.sh](DRAMSys/gem5/gem5_se/run.sh) is provided. Take a look and learn from it. ### [PARSEC] FS Mode -Full system simulation files for ARM available in [DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB](DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB). +Full system simulation files for ARM are available in [DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB](DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB). Choose the benchmark in [parsec_arm_minor_2c_8GB.rcS](DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB/parsec_arm_minor_2c_8GB.rcS) and edit the paths in [config.ini](DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB/config.ini). -Choose the benchmark in [parsec_arm_minor_2c_8GB.rcS](DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB/parsec_arm_minor_2c_8GB.rcS). +All files required to build DRAMSys_gem5 and execute the simulation (gem5 library, benchmarks, disk image, etc.) can be obtained with [gem5.TnT]. -Edit the paths in [config.ini](DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB/config.ini). - -All files required to build DRAMSys_gem5 and execute the simulation (gem5 -library, benchmarks, disk image, etc.) can be obtained with [gem5.TnT]. - -Start a simulation. Example: +Start a simulation, e.g.: ```bash -dram.sys/build/gem5$ ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/rgrsim-gem5-fs.json ../../DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB/config.ini 1 +DRAMSys/build/gem5$ ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/rgrsim-gem5-fs.json ../../DRAMSys/gem5/gem5_fs/parsec_arm_minor_2c_8GB/config.ini 1 ``` Optionally, open another terminal or tab and connect to gem5. @@ -195,7 +132,7 @@ Optionally, open another terminal or tab and connect to gem5. $ telnet localhost 3456 ``` -Note: the port may vary, gem5 prints it during initialization. Example: +Note: The port may vary, gem5 prints it during initialization. Example: ``` system.terminal: Listening for connections on port 3456 @@ -204,12 +141,7 @@ system.terminal: Listening for connections on port 3456 ### [PARSEC] SE Mode -Binaries and gem5 SE configuration files for ARM available in [DRAMSys/gem5/gem5_se/parsec-arm](DRAMSys/gem5/gem5_se/parsec-arm). - -Use [gem5.TnT] to download parsec. Example: - -Go to your **gem5.TnT** folder. Then go to **arch/arm** folder. Execute the -script *build-parsec-serial.sh*. +Binaries and gem5 SE configuration files for ARM available in [DRAMSys/gem5/gem5_se/parsec-arm](DRAMSys/gem5/gem5_se/parsec-arm). Use [gem5.TnT] to download parsec: Go to your *gem5.TnT* folder. Then go to *arch/arm* folder. Execute the script *build-parsec-serial.sh*. ```bash gem5.TnT/arch/arm$ ./build-parsec-serial.sh @@ -308,7 +240,7 @@ executable=../../DRAMSys/gem5/gem5_se/parsec-arm/blackscholes/blackscholes Start a simulation. Example: ```bash -dram.sys/build/gem5$ ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/rgrsim-gem5-se.json ../../DRAMSys/gem5/gem5_se/parsec-arm/config.ini 1 +DRAMSys/build/gem5$ ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/rgrsim-gem5-se.json ../../DRAMSys/gem5/gem5_se/parsec-arm/config.ini 1 ``` ### Boot Linux with gem5 and DRAMSys @@ -327,9 +259,9 @@ build/ARM/gem5.opt configs/example/fs.py \ --disk-image=linux-aarch32-ael.img ``` -The config.ini should be copied again to the DRAMSys_gem5 build folder. +The *config.ini* should be copied again to the DRAMSys_gem5 build folder. -The simconfig should be changed in order to support storage and address offsets: +The *simconfig* should be changed in order to support storage and address offsets: ``` json { @@ -341,11 +273,9 @@ The simconfig should be changed in order to support storage and address offsets: "EnableWindowing": false, "ErrorCSVFile": "", "ErrorChipSeed": 42, - "NumberOfDevicesOnDIMM": 8, - "NumberOfMemChannels": 1, "PowerAnalysis": false, "SimulationName": "ddr3", - "SimulationProgressBar": true, + "SimulationProgressBar": false, "ThermalSimulation": false, "WindowSize": 1000, @@ -356,13 +286,13 @@ The simconfig should be changed in order to support storage and address offsets: } ``` -Then start DRAMSys_gem5 with the following command: +Then start *DRAMSys_gem5* with the following command: ```bash ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/ddr3-example.json config.ini 1 ``` -For further sophisticated address mappings or scenarios checkout the file DRAMSys/gem5/main.cpp +For further sophisticated address mappings or scenarios checkout the file *DRAMSys/gem5/main.cpp*. #### Boot Linux with gem5 and DRAMSys Example @@ -386,24 +316,19 @@ Open a new terminal and connect to gem5: telnet localhost 3456 ``` -Wait some minutes for the Linux boot process to complete then login. Username is -**root** no password required. +Wait some minutes for the Linux boot process to complete then login. Username is **root**, no password required. ### DRAMSys with gem5 Elastic Traces -For understanding elastic traces and their generation, study the [gem5 -wiki](http://gem5.org/TraceCPU) and the paper [2]. -Some predefined configs are stored [here](DRAMSys/gem5/configs) and the related -python files are stored [here](DRAMSys/gem5/examples). - -This is an example for running an elastic trace: +To understand elastic traces and their generation, study the [gem5 wiki](https://www.gem5.org/documentation/general_docs/cpu_models/TraceCPU) and the paper [2]. Some predefined configs are stored [here](DRAMSys/gem5/configs) and the related +python files are stored [here](DRAMSys/gem5/examples). This is an example for running an elastic trace: ```bash ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/ddr3-example.json ../../DRAMSys/gem5/configs/singleElasticTraceReplay.ini 1 ``` -An overview of the architcture being simulated is presented below: +An overview of the architecture being simulated is presented below: ![arch](images/singleElasticTraceReplay.png) @@ -425,109 +350,13 @@ An overview of the architcture being simulated is presented below: ![arch](images/dualElasticTraceReplay.png) -For more spophisticated setups, even with l2 caches the proper ini file should be created. -If you need help please contact Matthias Jung. +For more sophisticated setups, even with L2 caches the proper *.ini* file should be created. -### DRAMSys + GEM5 Log Collector Scripts +### DRAMSys + gem5 x86 -Users can profit of running multiple **DRAMSys + gem5** simulations -automatically with [gem5ilva.sh] for **gem5 syscall emulation (SE) mode** and -[gem5ilva_fs.sh] for **gem5 full system (FS) mode**. +Make sure you have built *gem5/build/X86/libgem5_opt.so*. Add the path of the library to `LD_LIBRARY_PATH` and remove the path of the ARM library. -Normally you will have to push your changes before running the scripts. This -approach makes it easier to track back what exactly was tested by the scripts. - -The scripts provide variables that tell **git** where to get the source -code from (repository URL), user name to be used (your git account), -**branch** to checkout (your working branch), etc. They are: - -```bash -# Git info. -git_user="$USER" -git_branch="master" -git_url="git.eit.uni-kl.de:ems/astdm/dram.sys.git" -git_url_https="git.eit.uni-kl.de/ems/astdm/dram.sys.git" -``` - -The default values of the variables presented above assume that your git -account uses the same name as your user name in your PC. If that is not the -case, replace the value of the **git_user** variable with your git account -name. Similarly, replace the value of the variable **git_branch** with your -working branch name. There (in your working branch) you can push your changes -and/or new files before executing the scripts. - -Open the script in QtCreator or another text editor of your choice and set the -variables with values that fit your needs. - -Nevertheless, for some cases, you may want to have gem5 essential files out of -the main repository (usually because they are too big to be added to the -repository). - -For those cases uncomment and properly set the variable -**external_inifile_path** in [gem5ilva_fs.sh]. - -This allows you to use a gem5 **config.ini** file external to the repository. -Note, however, that in this case it is up to you to keep track of your -simulation setup. - -**Hint:** -[gem5.TnT] provides convenience scripts -to create gem5 disk images with benchmarking programs embedded. - - -### Coverage Check - -Coverage check is enabled by default and can be disabled with an environment -variable. - -```bash -export COVERAGE=true -``` - -### DRAMSys + GEM5 x86 - -Make sure you have built **gem5/build/X86/libgem5_opt.so**. If you build with -[gem5.TnT] you can check if the library exists as follows. - -```bash -$ ls $HOME/gem5_tnt/gem5/build/X86/libgem5_opt.so -``` - -Change your ~/.bashrc. - -```bash -# In this example gem5 is located at $HOME/gem5_tnt/gem5. -export GEM5=$HOME/gem5_tnt/gem5 - -# Add the folder containing libgem5_opt.so to the list where libraries should -# be searched for. -#export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GEM5}/build/ARM -export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GEM5}/build/X86 -``` - -After that close QtCreator and all terminals. - -Open a new terminal. - -Change the architecture in [DRAMSys/gem5/gem5.pro](DRAMSys/gem5/gem5.pro). - -``` -gem5_arch = 'X86' -``` - -Delete the file **DRAMSys/DRAMSys.pro.user** from the repository. - -```bash -$ rm DRAMSys/DRAMSys.pro.user -``` - -Open a new QtCreator. - -Build DRAMSys as usual. - -After building, go the the folder where *DRAMSys_gem5* is located. - -Test with a hello world application for X86. +Change the architecture in the [CMake file](DRAMSys/gem5/CMakeLists.txt) to *X86*, rerun CMake and rebuild the project. Test with a hello world application for X86: ```bash ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/ddr3-gem5-se.json ../../DRAMSys/gem5/gem5_se/hello-x86/config.ini 1 @@ -641,21 +470,16 @@ Examples: Check the folder [DRAMSys/gem5/gem5_se/MiBench](DRAMSys/gem5/gem5_se/MiBench) for all applications and configuration files. -### More AARCH64 Apps +### More AArch64 Apps -Full system simulation files for ARM available in [DRAMSys/gem5/gem5_fs/arm64](DRAMSys/gem5/gem5_fs/arm64). +Full system simulation files for ARM available in [DRAMSys/gem5/gem5_fs/arm64](DRAMSys/gem5/gem5_fs/arm64). You can edit [arm64.rcS](DRAMSys/gem5/gem5_fs/arm64/arm64.rcS) to start an application and call *m5 exit* when it finishes. -You can edit [arm64.rcS](DRAMSys/gem5/gem5_fs/arm64/arm64.rcS) to start an application and call *m5 exit* when it finishes. - -Edit the paths in [config.ini](DRAMSys/gem5/gem5_fs/arm64/config.ini). - -All files required to build DRAMSys_gem5 and execute the simulation (gem5 -library, benchmarks, disk image, etc.) can be obtained with [gem5.TnT]. +Edit the paths in [config.ini](DRAMSys/gem5/gem5_fs/arm64/config.ini). All files required to build DRAMSys_gem5 and execute the simulation (gem5 library, benchmarks, disk image, etc.) can be obtained with [gem5.TnT]. Start a simulation. Example: ```bash -dram.sys/build/gem5$ ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/rgrsim-gem5-fs.json ../../DRAMSys/gem5/gem5_fs/arm64/config.ini 1 +DRAMSys/build/gem5$ ./DRAMSys_gem5 ../../DRAMSys/library/resources/simulations/rgrsim-gem5-fs.json ../../DRAMSys/gem5/gem5_fs/arm64/config.ini 1 ``` Optionally, open another terminal or tab and connect to gem5. @@ -664,7 +488,7 @@ Optionally, open another terminal or tab and connect to gem5. $ telnet localhost 3456 ``` -Note: the port may vary, gem5 prints it during initialization. Example: +Note: The port may vary, gem5 prints it during initialization. Example: ``` system.terminal: Listening for connections on port 3456 @@ -677,11 +501,5 @@ C. Menard, M. Jung, J. Castrillon, N. Wehn. IEEE International Conference on Emb R. Jagtap, S. Diestelhorst, A. Hansson, M. Jung, N. Wehn, IEEE International Conference on Embedded Computer Systems Architectures Modeling and Simulation (SAMOS), 2016, Samos Island, Greece. [gem5.TnT]: https://github.com/tukl-msd/gem5.TnT -[gem5ilva.sh]: DRAMSys/library/resources/scripts/DRAMSylva/gem5ilva.sh -[gem5ilva_fs.sh]: DRAMSys/library/resources/scripts/DRAMSylva/gem5ilva_fs.sh -[Elwetritsch]: https://elwe.rhrk.uni-kl.de/ -[DRAMSylva.sh]: DRAMSys/library/resources/scripts/DRAMSylva/DRAMSylva.sh -[DRAMSylva folder]: DRAMSys/library/resources/scripts/DRAMSylva -[configs_json]: DRAMSys/library/resources/scripts/DRAMSylva/configs_json [MiBench]: http://vhosts.eecs.umich.edu/mibench/ [PARSEC]: http://parsec.cs.princeton.edu/ \ No newline at end of file diff --git a/README.md b/README.md index b3d4bdc4..f5166905 100644 --- a/README.md +++ b/README.md @@ -360,12 +360,9 @@ An example follows. - PowerDownTimeout (unsigned int) - currently unused -### DRAMSys with Thermal Simulation +## DRAMSys with Thermal Simulation -The thermal simulation is performed by a **3D-ICE** [8] server accessed -through the network. Therefore users interested in thermal simulation during -their DRAMSys simulations need to make sure they have a 3D-ICE server up and -running before starting. For more information about 3D-ICE visit the [official website](https://www.epfl.ch/labs/esl/open-source-software-projects/3d-ice/). +The thermal simulation is performed by a **3D-ICE** [8] server accessed through the network. Therefore users interested in thermal simulation during their DRAMSys simulations need to make sure they have a 3D-ICE server up and running before starting. For more information about 3D-ICE visit the [official website](https://www.epfl.ch/labs/esl/open-source-software-projects/3d-ice/). #### Installing 3D-ICE @@ -459,6 +456,10 @@ $ cd DRAMSys/build/simulator/ $ ./DRAMSys ../../DRAMSys/library/resources/simulations/wideio-thermal.json ``` +## DRAMSys with gem5 + +Further information about the usage of DRAMSys with gem5 can be found [here](DRAMSys/gem5/README.md). + ## References [1] TLM Modelling of 3D Stacked Wide I/O DRAM Subsystems, A Virtual Platform for Memory Controller Design Space Exploration