From c7dc8a235e0c9021458a9623ada421e28961d439 Mon Sep 17 00:00:00 2001 From: Ivan Markin Date: Tue, 7 Mar 2023 17:46:07 +0100 Subject: [PATCH] Use spanner job to render --- .dockerignore | 3 ++- .gitignore | 1 + Dockerfile | 2 +- render/begin.toml | 29 +++++++++++++++++++++++++++++ render/job.sh | 16 ---------------- render/render.sh | 15 --------------- render/render_state.py | 8 ++++---- 7 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 .gitignore create mode 100644 render/begin.toml delete mode 100644 render/job.sh delete mode 100644 render/render.sh diff --git a/.dockerignore b/.dockerignore index 8a0cba3..72ba566 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ Dockerfile +/aux /states /data /cache -/.git \ No newline at end of file +/.git diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6803217 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.aux diff --git a/Dockerfile b/Dockerfile index 874f9df..440d737 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,4 +47,4 @@ RUN python3 -c 'import scri' WORKDIR /opt/rose COPY . . ENV PV_PLUGIN_PATH=/opt/rose/plugins -ENTRYPOINT ["/bin/bash"] \ No newline at end of file +ENV PATH=${PATH}":/opt/rose/render" \ No newline at end of file diff --git a/render/begin.toml b/render/begin.toml new file mode 100644 index 0000000..952aac1 --- /dev/null +++ b/render/begin.toml @@ -0,0 +1,29 @@ +Name = "rose" +Type = "simple" + +Walltime = "4h" + +Nodes = 2 +TasksPerNode = 2 + +Email = "batch@example.com" + +InitScript = [ + "source /home/SPACK2023/share/spack/setup-env.sh", + "module load apptainer-1.0.3-gcc-12.2.0-aojy6ca" + ] + +Runtime = [ + "apptainer", + "exec", + "--bind /work:/work", + "--bind /scratch:/scratch", + "--env ROSE_CACHE_DIR=/scratch/user/rose-cache" + ] +Executable = "/home/user/apptainers/rose-v1.1.0.sif" +Arguments = [ + "render_state.py", + "--state={{.ConfigFilename}}", + "--total-task-number={{.TotalTaskNumber}}", + "--task-id={{.TaskID}}" + ] \ No newline at end of file diff --git a/render/job.sh b/render/job.sh deleted file mode 100644 index ea6011a..0000000 --- a/render/job.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -l -#SBATCH -J rose -#SBATCH -o /path/to/rose/states/rose.out -#SBATCH -e /path/to/rose/states/rose.err -#SBATCH --mail-type=ALL -#SBATCH --mail-user=rose-slurm@unkaktus.art -#SBATCH --ntasks=21 -#SBATCH --nodes=3 -#SBATCH --ntasks-per-node=7 -#SBATCH --time=48:00:00 - -source /home/SPACK2023/share/spack/setup-env.sh -module load apptainer-1.0.3-gcc-12.2.0-aojy6ca - -cd /path/to/rose -srun -n 21 ./render.sh states/state.pvsm \ No newline at end of file diff --git a/render/render.sh b/render/render.sh deleted file mode 100644 index d7e877a..0000000 --- a/render/render.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# This script is to be called from the batch job, -# so that Slurm environment variables are set after scheduling. - -STATE_NAME=${1%.*} -TOTAL_TASK_NUMBER=21 -echo "State name: $STATE_NAME" -mkdir -p "$STATE_NAME" - -apptainer exec --bind /scratch:/scratch \ - /path/to/rose.sif render_state.py \ - --state=$1 \ - --total-task-number=$TOTAL_TASK_NUMBER \ - --task-id=$(($SLURM_NODEID*$SLURM_NTASKS_PER_NODE + $SLURM_LOCALID)) \ - --output-dir=$STATE_NAME \ No newline at end of file diff --git a/render/render_state.py b/render/render_state.py index a0aae01..cbe9c31 100755 --- a/render/render_state.py +++ b/render/render_state.py @@ -1,17 +1,17 @@ #!/usr/bin/env -S python -u -import paraview.simple as pv -import numpy as np import argparse -import os -parser = argparse.ArgumentParser('rose') +parser = argparse.ArgumentParser('render_state.py') parser.add_argument("--total-task-number", type=int, help="Total number of tasks") parser.add_argument("--task-id", type=int, help="Current task ID") parser.add_argument("--state", type=str, help="State filename") parser.add_argument("--output-dir", type=str, help="Path to output directory", default=None) args = parser.parse_args() +import paraview.simple as pv +import numpy as np +import os output_dir = os.path.splitext(args.state)[0] if args.output_dir is not None: