Skip to content

Commit

Permalink
Add dockerfiles for each chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
powerjg committed Jan 4, 2017
1 parent 103ed7b commit 6b38500
Show file tree
Hide file tree
Showing 11 changed files with 233 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
_build/
_templates/
.git/
_static/figures/
_static/docker/
26 changes: 26 additions & 0 deletions _static/docker/base.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ubuntu:16.04

MAINTAINER Jason Lowe-Power <[email protected]>


# Install all of gem5's dependencies
RUN apt-get update -y && apt-get install -y \
build-essential \
python-dev \
scons \
swig \
zlib1g-dev \
m4 \
libprotobuf-dev \
python-protobuf \
protobuf-compiler \
libgoogle-perftools-dev
RUN apt-get install --no-install-recommends -y mercurial

# Download the gem5 source
WORKDIR /usr/local/src
RUN hg clone http://repo.gem5.org/gem5

# Build gem5
WORKDIR /usr/local/src/gem5
RUN scons build/X86/gem5.opt -j5
36 changes: 36 additions & 0 deletions _static/docker/build_all
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Change this to your docker username to push to docker hub
PREFIX=powerjg

build () {
echo "Building $1..."
docker build -q -t $1 -f $2 .
rc=$?
if [[ $rc != 0 ]]; then
echo "Failed"
exit $rc
else
echo "Done"
fi
}

push () {
docker push $1
echo
}

build powerjg/learning_gem5-base _static/docker/base.dockerfile


part1=( building simple-config cache-config two-level-opts )
for name in "${part1[@]}"; do
build $PREFIX/learning_gem5-part1-$name _static/docker/part1/$name.dockerfile
push $PREFIX/learning_gem5-part1-$name
done

part2=( helloobject debugging events parameters )
for name in "${part2[@]}"; do
build $PREFIX/learning_gem5-part2-$name _static/docker/part2/$name.dockerfile
push $PREFIX/learning_gem5-part2-$name
done
12 changes: 12 additions & 0 deletions _static/docker/part1/building.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM learning-gem5/base

MAINTAINER Jason Lowe-Power <[email protected]>



WORKDIR /usr/local/src/gem5


# Run with no script. Default test with --help
CMD ["build/X86/gem5.opt", \
"--help"]
16 changes: 16 additions & 0 deletions _static/docker/part1/cache-config.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM learning-gem5/base

MAINTAINER Jason Lowe-Power <[email protected]>

WORKDIR /usr/local/src/gem5

RUN mkdir -p /usr/local/src/gem5/configs/learning/part1/

# Copy script
COPY _static/scripts/part1/caches.py \
_static/scripts/part1/two_level.py \
/usr/local/src/gem5/configs/learning/part1/

# Run with the script
CMD ["build/X86/gem5.opt", \
"configs/learning/part1/two_level.py"]
15 changes: 15 additions & 0 deletions _static/docker/part1/simple-config.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM learning-gem5/base

MAINTAINER Jason Lowe-Power <[email protected]>

WORKDIR /usr/local/src/gem5

RUN mkdir -p /usr/local/src/gem5/configs/learning/part1/

# Copy script
COPY _static/scripts/part1/simple.py \
/usr/local/src/gem5/configs/learning/part1/

# Run with the script
CMD ["build/X86/gem5.opt", \
"configs/learning/part1/simple.py"]
17 changes: 17 additions & 0 deletions _static/docker/part1/two-level-opts.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM learning-gem5/base

MAINTAINER Jason Lowe-Power <[email protected]>

WORKDIR /usr/local/src/gem5

RUN mkdir -p /usr/local/src/gem5/configs/learning/part1/

# Copy script
COPY _static/scripts/part1/caches_opts.py \
_static/scripts/part1/two_level_opts.py \
/usr/local/src/gem5/configs/learning/part1/

# Run with the script
CMD ["build/X86/gem5.opt", \
"configs/learning/part1/two_level_opts.py", \
"--l2_size=1MB", "--l1d_size=128kB"]
27 changes: 27 additions & 0 deletions _static/docker/part2/debugging.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM learning-gem5/base

MAINTAINER Jason Lowe-Power <[email protected]>

WORKDIR /usr/local/src/gem5

RUN mkdir -p /usr/local/src/gem5/configs/learning/part2/ && \
mkdir -p /usr/local/src/gem5/src/learning/

# Copy script
COPY _static/scripts/part2/helloobject/run_hello.py \
/usr/local/src/gem5/configs/learning/part2/

# Copy code
COPY _static/scripts/part2/debugging/SConscript \
_static/scripts/part2/debugging/hello_object.cc \
_static/scripts/part2/helloobject/HelloObject.py \
_static/scripts/part2/helloobject/hello_object.hh \
/usr/local/src/gem5/src/learning_gem5/


RUN scons build/X86/gem5.opt -j5

# Run with the script
CMD ["build/X86/gem5.opt", \
"--debug-flags=Hello", \
"configs/learning/part2/run_hello.py"]
26 changes: 26 additions & 0 deletions _static/docker/part2/events.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM learning-gem5/base

MAINTAINER Jason Lowe-Power <[email protected]>

WORKDIR /usr/local/src/gem5

RUN mkdir -p /usr/local/src/gem5/configs/learning/part2/ && \
mkdir -p /usr/local/src/gem5/src/learning/

# Copy script
COPY _static/scripts/part2/helloobject/run_hello.py \
/usr/local/src/gem5/configs/learning/part2/

# Copy code
COPY _static/scripts/part2/helloobject/HelloObject.py \
_static/scripts/part2/debugging/SConscript \
_static/scripts/part2/events/hello_object.cc \
_static/scripts/part2/events/hello_object.hh \
/usr/local/src/gem5/src/learning_gem5/

RUN scons build/X86/gem5.opt -j5

# Run with the script
CMD ["build/X86/gem5.opt", \
"--debug-flags=Hello", \
"configs/learning/part2/run_hello.py"]
25 changes: 25 additions & 0 deletions _static/docker/part2/helloobject.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM learning-gem5/base

MAINTAINER Jason Lowe-Power <[email protected]>

WORKDIR /usr/local/src/gem5

RUN mkdir -p /usr/local/src/gem5/configs/learning/part2/ && \
mkdir -p /usr/local/src/gem5/src/learning/

# Copy script
COPY _static/scripts/part2/helloobject/run_hello.py \
/usr/local/src/gem5/configs/learning/part2/

# Copy code
COPY _static/scripts/part2/helloobject/HelloObject.py \
_static/scripts/part2/helloobject/SConscript \
_static/scripts/part2/helloobject/hello_object.cc \
_static/scripts/part2/helloobject/hello_object.hh \
/usr/local/src/gem5/src/learning_gem5/

RUN scons build/X86/gem5.opt -j5

# Run with the script
CMD ["build/X86/gem5.opt", \
"configs/learning/part2/run_hello.py"]
28 changes: 28 additions & 0 deletions _static/docker/part2/parameters.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM learning-gem5/base

MAINTAINER Jason Lowe-Power <[email protected]>

WORKDIR /usr/local/src/gem5

RUN mkdir -p /usr/local/src/gem5/configs/learning/part2/ && \
mkdir -p /usr/local/src/gem5/src/learning/

# Copy script
COPY _static/scripts/part2/parameters/hello_goodbye.py \
/usr/local/src/gem5/configs/learning/part2/

# Copy code
COPY _static/scripts/part2/parameters/HelloObject.py \
_static/scripts/part2/parameters/SConscript \
_static/scripts/part2/parameters/hello_object.cc \
_static/scripts/part2/parameters/hello_object.hh \
_static/scripts/part2/parameters/goodbye_object.cc \
_static/scripts/part2/parameters/goodbye_object.hh \
/usr/local/src/gem5/src/learning_gem5/

RUN scons build/X86/gem5.opt -j5

# Run with the script
CMD ["build/X86/gem5.opt", \
"--debug-flags=Hello", \
"configs/learning/part2/hello_goodbye.py"]

0 comments on commit 6b38500

Please sign in to comment.