Wednesday, February 27, 2013

Running PARSEC benchmarks on Gem5


While there is a step by step explanation on the gem5 site (http://www.m5sim.org/PARSEC_benchmarks) I had some troubles running the PARSEC benchmarks. So I think that you will find interesting this post.

The first step is to build the Full System Gem5, so you will need to write the variables in a file. You may use some different values, more information about them is here. I have used an ALPHA system (because the disks and binaries are provided for this platform) and MESI_CMP_directory for coherence. You have to put the file on gem5/build/variables/ALPHA_FS.

The command to build the system is:
scons ./build/ALPHA_FS/gem5.opt -j 8

The parameter j indicates how many processes should the compiler use. If you have enough RAM and processors you can put as many as you want. Obviously it will compile faster if you give more resources to the compiler.

The next step is to download everything that we need, if you download this file you will have everything. The files which I packed together are available here and here. The content of the file is:

PARSEC/
               binaries/
                           console
                           ts_osfpal
                           vmlinux
                disks/
                          linux-bigswap2.img
                          linux-parsec-2-1-m5.img

Then we have to modify two files as indicated at http://www.m5sim.org/PARSEC_benchmarks. The first one is gem5/configs/common/SysPaths.py and we have to change this line:

path = [ ’/dist/m5/system’, ’<complete path to your disks and binaries directory>’ ]


So we will write the path to our directory PARSEC.

The second file we have to modify is gem5/configs/common/Benchmarks.py. There we have to write the name of our linux image:

return env.get(’LINUX_IMAGE’, disk(’linux-parsec-2-1-m5.img’))

Then we need a scrip to run some benchmarks, I have used the one provided at http://www.m5sim.org/PARSEC_benchmarks#Running_PARSEC_in_gem5 you can download it here.

Finally you can run gem5 and it will (should) work like a charm:

./build/ALPHA_FS/gem5.opt ./configs/example/fs.py --script=../PARSEC/runscript.rcS

It will run the blackscholes benchmark.

If you want to run other benchmarks may you use the script generator available at http://www.cs.utexas.edu/~parsec_m5/

Sunday, February 3, 2013

Take the First Step

To take the first step we have to download, compile and launch GEM5.

  1. So, we need to download some tools:
    1. GCC, the most common C compiler on linux.
    2. Python, at least 2.4. Available at http://www.python.org/
    3. Scons, "SCons is an Open Source software construction tool". It is similar to Make utility. You can download it from www.scons.org
    4. Swig, a connector between C/C++ and some high-level programming languages. http://swig.org/
  2. After install the dependencies we have to download the GEM5 source code:
    1. You need mercurial (hg) to download the source code. It is time to install it if you haven't it yet.
    2. If you already installed mercurial you are ready to clone the repository: hg clone http://repo.gem5.org/gem5
    3. That is the development repository, so you may want to update it in the future. You can do it with hg pull and hg update.
  3. If everything worked until now it is time to compile GEM5:
    1. You only have to run scons buid/ARM/gem5.opt in the gem5 directory. That will compile a default version of GEM5. Of course some options can be provided to the compiler to change the CPU type, cache coherence,.. You may want to use the option -j value where value indicates how many processors should the compiler uses while compiling (be careful if you don't have more than 4GB of RAM).
  4. If it compiled without any errors we can run a test in order to check that everything is fine. The command is ./build/ARM/gem5.opt ./configs/example/se.py - c queens -o 8. You can download the queens binary from https://mega.co.nz/#!z5I0AKAa!PkzayRAPWnJszt_qSZOmJxxh0_EixGZ1Gsux2GnChJw (448 KB). It should find 92 solutions if it worked.
That's all, if you had any problems you can find more information in the web. Although I highly recommend you to check the links at the end of the post.

Further info can be found at:

Good news everyone

I am working on my thesis and I am going to use gem5 a lot, so I have decided to tell the world what I am doing.

I hope someone will find interesting and useful what I want to write on this blog. I am having some troubles to start working with gem5 since it is a specialized tool and there isn't so much information about some topics. Or they are really hard to understand (if it is the first time that you use this amazing tool).

I think I will be writing frequently the next week, since I have been using GEM5 for a while now. And I am already able to do some basic operations.