Docker/Gem5 Setup for Tetracosa

Setup Steps

  1. You need to log onto the tetracosa.cs.ucla.edu server first with your <YOUR USERNAME>.
    ssh <YOUR USERNAME>@tetracosa.cs.ucla.edu
    
  2. Create a directory named as <YOUR USERNAME> under the directory /usr/eda/CS251A
    mkdir /usr/eda/CS251A/<YOUR USERNAME>
    

    feel free to share your container with your partners! : )

  3. Create a docker container by using the following command.
    docker run -tid --hostname=cs251a --name=cs251a-<YOUR USERNAME> -v /usr/eda/CS251A/<YOUR USERNAME>:/root gcr.io/gem5-test/ubuntu-20.04_all-dependencies:latest /bin/bash
    

    For example, if your username is happy251, your command for creating container should be

    # log onto server
    ssh happy251@tetracosa.cs.ucla.edu
    # create your directory
    mkdir /usr/eda/CS251A/happy251
    # create your container
    docker run -tid --hostname=cs251a --name=cs251a-happy251 -v /usr/eda/CS251A/happy251:/root gcr.io/gem5-test/ubuntu-20.04_all-dependencies:latest /bin/bash
    
  4. Enter your container and change directory to /root
    # Enter container
    docker exec -ti cs251a-<YOUR USERNAME> /bin/bash
    # Change directory to /root
    cd /root
    
  5. Get the gem5 code
    git clone https://github.com/gem5/gem5.git
    
  6. Build the gem5
    cd gem5
    scons build/X86/gem5.opt -j 8
    
  7. Test and execute the gem5 simulator
    build/X86/gem5.opt configs/learning_gem5/part1/simple.py
    

If you see something like below as the output, your gem5 setup is successful.

...
...
...
Beginning simulation!
info: Entering event queue @ 0.  Starting simulation...
Hello world!
Exiting @ tick 489304000 because exiting with last active thread context

Exit and Re-Enter the container

  1. After you finished your work, you may want to exit the container by either pressing Ctrl-d or enter exit
    # Exit the container
    root@cs251a:~# exit
    exit
    
  2. If you want to re-enter the container, you can use the following commands to enter your container.
    # log onto tetracosa if you have not
    ssh <YOUR USERNAME>@tetracosa.cs.ucla.edu
    # Re-enter your container
    docker exec -ti cs251a-<YOUR USERNAME> /bin/bash
    # Change directory to /root
    cd /root
    # Start your work
    ...