Quick gem5 Build Guide for Alpha ISA on Ubuntu 12.04 x86-x64 Host

Mark Gottscho | Oct 25, 2013 min read

In this guide, I will walk you through a quick way to get gem5 built for the Alpha ISA using a Ubuntu 12.04 64-bit host. I have not tried these methods on any other platform. If you get stuck, you can always refer to the documentation at gem5.org. Nothing is presented here that doesn’t already exist somewhere else, but I found that some other methods did not work for me. These steps are based on gem5 revision f75ee4849c40 and the website as of 10/24/13. Please refer to the website for any specific version requirements. Make sure you have the following tools:

  • mercurial (even if you don’t use it for version tracking, you can pull the gem5 source this way)

  • scons (a build tool required for gem5 compilation)

  • g (C compiler)

  • Python (gem5 is partly implemented in Python and partly in C++)

  • SWIG

  • zlib

  • m4 (macro processor)

  • protobuf

Obtain the gem5 package from gem5.org. Use mercurial to get the stable version:

Once you are inside the gem5 source tree, initiate the build process. This will build gem5 to work for the Alpha ISA using “opt” level of optimizations but preserves some debug features. If you want the fastest gem5 build, use gem5.fast. There are also other debug modes as needed.

  • scons build/ALPHA/gem5.opt

Note that if you have a multiprocessor machine (who doesn’t nowadays?) you can speed up the build with multiple threads (8 in this example):

  • scons build/ALPHA/gem5.fast -j8

If your build was successful (mine takes about 5-10 minutes from scratch), you will see scons reporting done. If you ever need to clean the build, just do:

  • scons --clean.

Test your build!

  • build/ALPHA/gem5.opt configs/example/se.py -c tests/test-progs/hello/bin/alpha/linux/hello

gem5 has two main components to its runtime. The simulator binary accepts a Python configuration script as its input, which also has its list of parameters. In the above test example, the gem5 binary is build/ALPHA/gem5.opt, the configuration script is configs/example/se.py, and the C binary (compiled separately for Alpha) is tests/test-progs/hello/bin/alpha/linux/hello which is a Hello World program. gem5 can run in two primary modes: system call emulation (SE), and full system simulation (FS). Generally, SE will run much faster, but if you are interested in analyzing behavior beyond a single application, you will need full system mode to capture inter-process communications, peripherals, and the OS itself, of course. You can see the help for the gem5 binary and the given Python configuration script independently. Note that for most of your own simulator configuration (changing processor specs, cache sizes, etc.) you will do this in the Python configuration script. You can also modify it to accept custom command line arguments so you can do some fancy script nesting. Anyway, that’s the end of this quick tutorial. gem5 takes a while to figure out how to properly use it, much less modify it for your needs. However, it is very powerful and all open source, so I recommend reading through the configuration scripts first to get an idea how it works before diving into the nitty gritty simulator details. I’ll post a tutorial later on getting the SPEC2006 benchmarks running for this setup. Good luck!

comments powered by Disqus