Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seissol first example to workflow #1

Merged
merged 30 commits into from
Jul 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.sw?

.idea
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "seissol"]
path = seissol
[submodule "submodules/seissol"]
path = submodules/seissol
url = https://github.com/ivotron/seissol
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
dist: xenial
language: python
python: 3.7
services: docker
install:
- git clone https://github.com/systemslab/popper /tmp/popper
- export PYTHONUNBUFFERED=1
- pip install /tmp/popper/cli
script: popper run
1 change: 0 additions & 1 deletion seissol
Submodule seissol deleted from bf2034
1 change: 1 addition & 0 deletions submodules/seissol
Submodule seissol added at bcd0c0
31 changes: 31 additions & 0 deletions workflows/tpv33/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SeisSol TPV33 Benchmark

This example workflow follows the [_A First Example_][tutorial]
tutorial from SeisSol's official documentation, which corresponds to
the [SCEC TPV33 benchmark][scec].

## Workflow

The workflow defined in [`main.workflow`](./main.workflow)) consists
of four actions:

* **`remove previous builds`**. Deletes any previously-compiled
binaries to avoid any confusion while running the workflow.

* **`build`**: Compiles SeisSol and generates the executable. The
build environment is defined in the accompanying
[`actions/seissol`](./actions/seissol) action folder, specifically
in the [`Dockerfile`](./actions/seissol/Dockerfile).

* **`download data and parameters`**: Downloads the data and
parameter files required to execute the benchmark. These are saved
in an `execution/` folder.

* **`execute`**: Runs the benchmark with the specified parameters:
* `OMP_NUM_THREADS`. Number of OpenMP threads to use.
* `MPI_NUM_PROCESSES`. Number of MPI processes to use.
* `SEISSOL_END_TIME`. Abort condition for the simulation (real
number).

[tutorial]: https://seissol.readthedocs.io/en/latest/a-first-example.html#a-first-example
[scec]: http://scecdata.usc.edu/cvws/tpv33docs.html
29 changes: 29 additions & 0 deletions workflows/tpv33/actions/seissol/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:disco

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && \
apt install -y \
curl git \
build-essential gfortran cmake \
libeigen3-dev \
libopenmpi-dev \
libhdf5-dev libhdf5-mpi-dev \
libparmetis-dev \
virtualenv && \
virtualenv -p python3 /scons && \
bash -c 'source /scons/bin/activate && pip install numpy>=1.12.0 lxml scons' && \
rm -rf /var/lib/apt/lists/*

# install libxsmm
RUN curl -LO https://github.com/hfp/libxsmm/archive/master.tar.gz && \
tar xvfz master.tar.gz && \
cd libxsmm-master && \
make generator && \
cp bin/libxsmm_gemm_generator /usr/bin && \
cd / && \
rm -rf libxsmm-master /var/lib/apt/lists/*

ADD entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]
13 changes: 13 additions & 0 deletions workflows/tpv33/actions/seissol/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e

source /scons/bin/activate

if [ -z "$SEISSOL_SRC_DIR" ]; then
echo "Expecting SEISSOL_SRC_DIR variable"
exit 1
fi

cd $SEISSOL_SRC_DIR

scons "$@"
48 changes: 48 additions & 0 deletions workflows/tpv33/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
workflow "tpv33" {
on = "push"
resolves = "execute"
}

action "remove previous builds" {
uses = "actions/bin/sh@master"
args = ["rm -f submodules/seissol/build/SeisSol_*"]
}

action "build" {
needs = "remove previous builds"
uses = "./workflows/tpv33/actions/seissol"
args = [
"compileMode=release",
"order=2",
"parallelization=hybrid",
"hdf5=yes",
"metis=yes",
"commThread=no",
"compiler=gcc",
"-j8",
]
env = {
SEISSOL_SRC_DIR = "submodules/seissol"
}
}
ivotron marked this conversation as resolved.
Show resolved Hide resolved

action "download data and parameters"{
needs = "build"
uses = "./workflows/tpv33/actions/seissol"
runs = ["sh", "-c", "workflows/tpv33/scripts/download.sh"]
env = {
SEISSOL_SRC_DIR = "submodules/seissol"
}
}

action "execute"{
needs = "download data and parameters"
uses = "./workflows/tpv33/actions/seissol"
runs = ["sh", "-c","workflows/tpv33/scripts/execute.sh"]
env = {
SEISSOL_SRC_DIR = "submodules/seissol"
OMP_NUM_THREADS = 1
MPI_NUM_PROCESSES = 1
SEISSOL_END_TIME = 0.00001
}
}
21 changes: 21 additions & 0 deletions workflows/tpv33/scripts/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e

if [ -z "$SEISSOL_SRC_DIR" ]; then
echo "Expecting SEISSOL_SRC_DIR variable"
exit 1
fi

mkdir -p "$GITHUB_WORKSPACE/workflows/tpv33/execution"

cd "$GITHUB_WORKSPACE/workflows/tpv33/execution"

curl -LO https://syncandshare.lrz.de/dl/fiEi52Xiwwqkf2sNpTrCHjhw/tpv33_gmsh.xdmf
curl -LO https://syncandshare.lrz.de/dl/fi72mQiszp6vSs7qN8tdZJf9/tpv33_gmsh
curl -LO https://github.com/SeisSol/Examples/archive/master.tar.gz

tar xzf master.tar.gz
cp Examples-master/tpv33/* .
rm -rf Examples-master master.tar.gz

echo "$GITHUB_WORKSPACE/$SEISSOL_SRC_DIR/Maple/" > DGPATH
43 changes: 43 additions & 0 deletions workflows/tpv33/scripts/execute.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -e

if [ -z "$SEISSOL_SRC_DIR" ]; then
echo "Expecting SEISSOL_SRC_DIR variable"
exit 1
fi
if [ -z "$OMP_NUM_THREADS" ]; then
echo "No OMP_NUM_THREADS variable defined"
exit 1
fi
if [ -z "$MPI_NUM_PROCESSES" ]; then
echo "No MPI_NUM_ROCESSES variable defined"
exit
fi
if [ -z "$SEISSOL_END_TIME" ]; then
echo "No SEISSOL_END_TIME variable defined"
exit 1
fi

EXECUTION_DIR="$PWD/workflows/tpv33/execution/"

# TODO: we assume that there's only one binary in the build/ folder. Instead, we
# can look for a SEISSOL_BIN variable and use that if defined; otherwise we can
# try to copy whatever binary is there but throw an error if there's more than
# one available
SEISSOL_BIN="$(ls $GITHUB_WORKSPACE/$SEISSOL_SRC_DIR/build/SeisSol_*)"

cp "$SEISSOL_BIN" "$EXECUTION_DIR"

mkdir -p "$EXECUTION_DIR/output"

# run
cd "$EXECUTION_DIR"

sed -i "s#EndTime = .*#EndTime = $SEISSOL_END_TIME#" parameters_tpv33_master.par

mpirun \
--allow-run-as-root \
--oversubscribe \
-np "$MPI_NUM_PROCESSES" \
"$SEISSOL_BIN" \
parameters_tpv33_master.par