Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Last active May 26, 2020 14:29
Show Gist options
  • Save kaityo256/fa963c940ea8f14ddc91df2de1c8979f to your computer and use it in GitHub Desktop.
Save kaityo256/fa963c940ea8f14ddc91df2de1c8979f to your computer and use it in GitHub Desktop.
Dockerfile for Riken Simulator
FROM ubuntu:18.04
MAINTAINER kaityo256
ENV USER user
ENV HOME /home/${USER}
ENV SHELL /bin/bash
RUN useradd -m ${USER}
RUN gpasswd -a ${USER} sudo
RUN echo 'user:userpass' | chpasswd
RUN apt-get update && apt-get install -y \
g++ \
g++-8-aarch64-linux-gnu \
git \
m4 \
python-dev \
scons \
sudo \
vim \
zlib1g-dev
USER ${USER}
RUN cd ${HOME} \
&& mkdir build \
&& cd build \
&& git clone --depth 1 https://github.com/RIKEN-RCCS/riken_simulator.git
RUN cd ${HOME} \
&& cd build/riken_simulator \
&& sed -i "369,372s:^:#:" SConstruct \
&& scons build/ARM/gem5.opt -j 20
@kaityo256
Copy link
Author

kaityo256 commented May 26, 2020

You may change the number of processes used for the build.

scons build/ARM/gem5.opt -j 20
                            ^^

Build & Run.

docker build --t kaityo256/rikensimulator .
docker run -it kaityo256/rikensimulator /bin/bash

Then you can use Riken Simulator as follows.

$ cd
$ vim test.c # Edit new C file 
$ cat test.c
#include <stdio.h>
int main(){
  puts("Hello from Docker\n");
}
$ aarch64-linux-gnu-gcc-8 -static test.c
$ cd build/riken_simulator/
$ ./build/ARM/gem5.opt  ./configs/example/se.py -c ~/a.out

You will obtain the following outputs.

gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 compiled May 26 2020 13:28:49
gem5 started May 26 2020 13:45:49
gem5 executing on 7174f8223bb5, pid 24
command line: ./build/ARM/gem5.opt ./configs/example/se.py -c /home/user/a.out

/home/user/build/riken_simulator/configs/common/CacheConfig.py:51: SyntaxWarning: import * only allowed at module level
  def config_cache(options, system):
/home/user/build/riken_simulator/configs/common/CacheConfig.py:51: SyntaxWarning: import * only allowed at module level
  def config_cache(options, system):
Global frequency set at 1000000000000 ticks per second
warn: Cache line size is neither 16, 32, 64 nor 128 bytes.
warn: Sockets disabled, not accepting gdb connections
**** REAL SIMULATION ****
info: Entering event queue @ 0.  Starting simulation...
warn: readlink() called on '/proc/self/exe' may yield unexpected results in various settings.
      Returning '/home/user/a.out'
Hello from Docker

Exiting @ tick 3924500 because exiting with last active thread context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment