Skip to content

Commit

Permalink
nightly data docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Sep 18, 2024
1 parent 2f84939 commit cfc9a84
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
12 changes: 12 additions & 0 deletions res/docker/nightly/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG RELEASE=40
FROM 129.104.6.165:32219/phare/teamcity-fedora_dep:$RELEASE

ENV OMPI_ALLOW_RUN_AS_ROOT=1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
ENV TMPDIR=/tmp
ENV MODULEPATH=/etc/scl/modulefiles:/etc/scl/modulefiles:/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles
ENV PYTHONPATH="/root/phare:/root/phare/build:/root/phare/pyphare"

WORKDIR /root
COPY run.sh /root
RUN chmod +x run.sh && ./run.sh
8 changes: 8 additions & 0 deletions res/docker/nightly/build_and_push_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
RELEASE=${1:-40}
REGISTRY=${2:-"129.104.6.165:32219"}
IMAGE="phare/teamcity-fedora_data"
FULL_NAME="${REGISTRY}/${IMAGE}:${RELEASE}"
$BASEDIR/build_image.sh $RELEASE $REGISTRY
docker push $FULL_NAME
6 changes: 6 additions & 0 deletions res/docker/nightly/build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
RELEASE=${1:-40}
REGISTRY=${2:-"129.104.6.165:32219"}
IMAGE="phare/teamcity-fedora_data"
FULL_NAME="${REGISTRY}/${IMAGE}:${RELEASE}"
docker build --build-arg RELEASE=$RELEASE -t ${FULL_NAME} .
24 changes: 24 additions & 0 deletions res/docker/nightly/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -xe

eval "$(modulecmd bash load mpi/openmpi-x86_64)"

(
cd /root
git clone https://github.com/PHAREHUB/PHARE --depth 10 --recursive --shallow-submodules phare
cd phare && mkdir build && cd build

# we are not keeping these binaries, only output data - portability is not an issue
CMAKE_CXX_FLAGS="-DNDEBUG -g0 -O3 -march=native -mtune=native"
CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -DPHARE_DIAG_DOUBLES=1"
CMAKE_CONFIG="-DCMAKE_BUILD_TYPE=Release"
cmake -G Ninja ${CMAKE_CONFIG} -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" ..
ninja
)

(
cd /root/phare
export PYTHONPATH="$PWD:$PWD/build:$PWD/pyphare"
./tools/data/generate.sh
)
rm -rf /root/phare
8 changes: 8 additions & 0 deletions tools/data/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -ex
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

(
cd $CWD
mpirun -n 4 tests/simulator/test_init_from_samrai.py
)
22 changes: 22 additions & 0 deletions tools/data/tests/simulator/test_init_from_samrai.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import copy
import numpy as np
import pyphare.pharein as ph
from pyphare.simulator.simulator import Simulator
from tests.simulator import test_restarts
from tests.diagnostic import dump_all_diags
from pathlib import Path

time_step = 0.001
time_step_nbr = 5
final_time = time_step_nbr * time_step
timestamps = np.arange(0, final_time + time_step, time_step)
first_out = str(Path.home() / "phare_data" / "tests/simulator/test_from_init")

if __name__ == "__main__":
simput = copy.deepcopy(test_restarts.simArgs)
simput["restart_options"]["dir"] = first_out
simput["restart_options"]["timestamps"] = timestamps
simput["diag_options"]["options"]["dir"] = first_out
sim = ph.Simulation(**simput)
dump_all_diags(test_restarts.setup_model().populations, timestamps=timestamps)
Simulator(sim).run()

0 comments on commit cfc9a84

Please sign in to comment.