From 35e0099e9934c18b07c5add1ca4cbf93207823f0 Mon Sep 17 00:00:00 2001 From: David Minton Date: Wed, 7 Jun 2023 08:52:57 -0400 Subject: [PATCH] Updates to singularity scripts and also added apptainer scripts --- apptainer/.gitignore | 5 +++++ apptainer/bin/swiftest_driver | 2 ++ apptainer/bin/swiftest_python | 2 ++ apptainer/install.sh | 10 ++++++++++ apptainer/setenv.sh | 4 ++++ singularity/.gitignore | 1 + singularity/bin/swiftest_driver | 2 +- singularity/bin/swiftest_python | 2 ++ 8 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 apptainer/.gitignore create mode 100755 apptainer/bin/swiftest_driver create mode 100755 apptainer/bin/swiftest_python create mode 100755 apptainer/install.sh create mode 100755 apptainer/setenv.sh create mode 100755 singularity/bin/swiftest_python diff --git a/apptainer/.gitignore b/apptainer/.gitignore new file mode 100644 index 000000000..6ddbdba9f --- /dev/null +++ b/apptainer/.gitignore @@ -0,0 +1,5 @@ +!bin/ +!bin/swiftest_driver +!bin/swiftest_python +!install.sh +!setenv.sh diff --git a/apptainer/bin/swiftest_driver b/apptainer/bin/swiftest_driver new file mode 100755 index 000000000..fa008737a --- /dev/null +++ b/apptainer/bin/swiftest_driver @@ -0,0 +1,2 @@ +#!/bin/sh -- +apptainer exec --bind $(pwd):$(pwd) --env OMP_NUM_THREADS=${OMP_NUM_THREADS},FOR_COARRAY_NUM_IMAGES=${FOR_COARRAY_NUM_IMAGES} ${SWIFTEST_SIF} swiftest_driver "$@" \ No newline at end of file diff --git a/apptainer/bin/swiftest_python b/apptainer/bin/swiftest_python new file mode 100755 index 000000000..b33012e4a --- /dev/null +++ b/apptainer/bin/swiftest_python @@ -0,0 +1,2 @@ +#!/bin/sh -- +apptainer run --bind $(pwd):$(pwd) --env OMP_NUM_THREADS=${OMP_NUM_THREADS},FOR_COARRAY_NUM_IMAGES=${FOR_COARRAY_NUM_IMAGES} ${SWIFTEST_SIF} swiftest_driver "$@" \ No newline at end of file diff --git a/apptainer/install.sh b/apptainer/install.sh new file mode 100755 index 000000000..abf9f4f91 --- /dev/null +++ b/apptainer/install.sh @@ -0,0 +1,10 @@ +#!/bin/sh -- +# This will install the Singularity container version of the swiftest_driver in place of the native compiled version into ../bin. +# In order to use the executable script, the SWIFTEST_SIF environment variable must be set to point to the location of swiftest_driver.sif, which requires this script to be called via source: +# $ . ./install.sh +# +tag=${1:-latest} +echo "Installing swiftest_driver.sif Singularity container and executable script from swiftest_driver:${tag} Docker container" +apptainer pull --force swiftest.sif docker://daminton/swiftest:${tag} +cp -rf bin/swiftest_driver ../bin/ +source ./setenv.sh \ No newline at end of file diff --git a/apptainer/setenv.sh b/apptainer/setenv.sh new file mode 100755 index 000000000..82ca7d408 --- /dev/null +++ b/apptainer/setenv.sh @@ -0,0 +1,4 @@ +#!/bin/sh -- +# This will set the SWIFTEST_SIF environment variable as long as it is executed by source. +# $ . ./setenv.sh +export SWIFTEST="${PWD}/swiftest.sif" \ No newline at end of file diff --git a/singularity/.gitignore b/singularity/.gitignore index 2a259d270..6ddbdba9f 100644 --- a/singularity/.gitignore +++ b/singularity/.gitignore @@ -1,4 +1,5 @@ !bin/ !bin/swiftest_driver +!bin/swiftest_python !install.sh !setenv.sh diff --git a/singularity/bin/swiftest_driver b/singularity/bin/swiftest_driver index 30fe6352b..03876195b 100755 --- a/singularity/bin/swiftest_driver +++ b/singularity/bin/swiftest_driver @@ -1,2 +1,2 @@ #!/bin/sh -- -singularity run --bind $(pwd):$(pwd) exec --env OMP_NUM_THREADS=${OMP_NUM_THREADS},FOR_COARRAY_NUM_IMAGES=${FOR_COARRAY_NUM_IMAGES} ${SWIFTEST_SIF} swiftest_driver "$@" \ No newline at end of file +singularity exec --bind $(pwd):$(pwd) --env OMP_NUM_THREADS=${OMP_NUM_THREADS},FOR_COARRAY_NUM_IMAGES=${FOR_COARRAY_NUM_IMAGES} ${SWIFTEST_SIF} swiftest_driver "$@" \ No newline at end of file diff --git a/singularity/bin/swiftest_python b/singularity/bin/swiftest_python new file mode 100755 index 000000000..4061ff119 --- /dev/null +++ b/singularity/bin/swiftest_python @@ -0,0 +1,2 @@ +#!/bin/sh -- +singularity run --bind $(pwd):$(pwd) --env OMP_NUM_THREADS=${OMP_NUM_THREADS},FOR_COARRAY_NUM_IMAGES=${FOR_COARRAY_NUM_IMAGES} ${SWIFTEST_SIF} swiftest_driver "$@" \ No newline at end of file