From 64ef94c348e2116ab5f0cbfdccc0080ad96534e6 Mon Sep 17 00:00:00 2001 From: lassejsc Date: Fri, 27 Feb 2026 13:16:43 +0200 Subject: [PATCH 1/9] Added lumicontainer builder script --- lumi_container.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lumi_container.sh diff --git a/lumi_container.sh b/lumi_container.sh new file mode 100644 index 000000000..ebf428b09 --- /dev/null +++ b/lumi_container.sh @@ -0,0 +1,38 @@ +#!/bin/bash +#Make container.def +if [ -f ./container.def ]; then + cat << EOF > container.def + Bootstrap: docker + From: docker.io/opensuse/leap:15.6 + + %post + # Continue to install software into the container normally. + # Building: + # module load LUMI systools + # singularity build container.sif container.def + # Running: + # For example launching python (one can also launch bash for example) + # singularity exec container.sif python + + zypper -n --no-gpg-checks install python312 python312-pip python312-setuptools python312-devel git + + update-alternatives --install /usr/bin/python python /usr/bin/python3.12 3 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 3 + update-alternatives --install /usr/bin/pip pip /usr/bin/pip3.12 3 + update-alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.12 3 + + export PYTHONNOUSERSITE=1 + pip install git+https://github.com/alhom/analysator-backends/releases/tag/v0.0.2 + pip install --editable git+https://github.com/fmihpc/analysator#egg=analysator" + EOF + + #Build the container + module load LUMI systools + singularity build container.sif container.def +else + export PYTHONNOUSERSITE=1 + singulairty exec container.def bash +fi + + + From 815de6301fd507539a654d97b25974484d957343 Mon Sep 17 00:00:00 2001 From: lassejsc Date: Thu, 12 Mar 2026 18:49:53 +0200 Subject: [PATCH 2/9] Added way to define python version with PY_VERSION env var, defaults to 3.12 if not givne --- lumi_container.sh | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/lumi_container.sh b/lumi_container.sh index ebf428b09..d7f72dddb 100644 --- a/lumi_container.sh +++ b/lumi_container.sh @@ -1,37 +1,45 @@ #!/bin/bash #Make container.def -if [ -f ./container.def ]; then + +if [[ "$PY_VERSION" ]]; then + PY_PACKAGE=$(echo "$PY_VERSION" | sed 's/\.//g' ) +else + PY_VERSION="3.12" + PY_PACKAGE="312" +fi + +if [ ! -f ./container.def ]; then cat << EOF > container.def - Bootstrap: docker - From: docker.io/opensuse/leap:15.6 +Bootstrap: docker +From: docker.io/opensuse/leap:15.6 - %post - # Continue to install software into the container normally. - # Building: - # module load LUMI systools - # singularity build container.sif container.def - # Running: - # For example launching python (one can also launch bash for example) - # singularity exec container.sif python +%post + # Continue to install software into the container normally. + # Building: + # module load LUMI systools + # singularity build container.sif container.def + # Running: + # For example launching python (one can also launch bash for example) + # singularity exec container.sif python - zypper -n --no-gpg-checks install python312 python312-pip python312-setuptools python312-devel git + zypper -n --no-gpg-checks install python$PY_PACKAGE python$PY_PACKAGE-pip python$PY_PACKAGE-setuptools python$PY_PACKAGE-devel git - update-alternatives --install /usr/bin/python python /usr/bin/python3.12 3 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 3 - update-alternatives --install /usr/bin/pip pip /usr/bin/pip3.12 3 - update-alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.12 3 + update-alternatives --install /usr/bin/python python /usr/bin/python$PY_VERSION 3 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python$PY_VERSION 3 + update-alternatives --install /usr/bin/pip pip /usr/bin/pip$PY_VERSION 3 + update-alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip$PY_VERSION 3 export PYTHONNOUSERSITE=1 - pip install git+https://github.com/alhom/analysator-backends/releases/tag/v0.0.2 + pip install --extra-index-url https://version.helsinki.fi/api/v4/projects/5244/packages/pypi/simple vlsvrs pip install --editable git+https://github.com/fmihpc/analysator#egg=analysator" - EOF +EOF #Build the container module load LUMI systools singularity build container.sif container.def else export PYTHONNOUSERSITE=1 - singulairty exec container.def bash + singularity exec container.def bash fi From 47abf57b5dfffbe3820ed758231da2e89e7e733a Mon Sep 17 00:00:00 2001 From: lassjsc Date: Mon, 23 Mar 2026 17:39:29 +0200 Subject: [PATCH 3/9] typo in singularity exec --- lumi_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 lumi_container.sh diff --git a/lumi_container.sh b/lumi_container.sh old mode 100644 new mode 100755 index d7f72dddb..0cc5a9e88 --- a/lumi_container.sh +++ b/lumi_container.sh @@ -39,7 +39,7 @@ EOF singularity build container.sif container.def else export PYTHONNOUSERSITE=1 - singularity exec container.def bash + singularity exec container.sif bash fi From 0a536299507b0d02e880eaa61846f93beb7144d8 Mon Sep 17 00:00:00 2001 From: lassejsc Date: Wed, 22 Apr 2026 11:17:21 +0300 Subject: [PATCH 4/9] Added missing " --- lumi_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lumi_container.sh b/lumi_container.sh index 0cc5a9e88..f6855cd20 100755 --- a/lumi_container.sh +++ b/lumi_container.sh @@ -31,7 +31,7 @@ From: docker.io/opensuse/leap:15.6 export PYTHONNOUSERSITE=1 pip install --extra-index-url https://version.helsinki.fi/api/v4/projects/5244/packages/pypi/simple vlsvrs - pip install --editable git+https://github.com/fmihpc/analysator#egg=analysator" + pip install --editable git+"https://github.com/fmihpc/analysator#egg=analysator" EOF #Build the container From d6122c751ceb56a48741ff08b2d4197d671b8a49 Mon Sep 17 00:00:00 2001 From: lassejsc Date: Wed, 22 Apr 2026 11:19:08 +0300 Subject: [PATCH 5/9] Changed the file check such that it makes the container if the .sif (container itself) is not found, previously was checking against .def --- lumi_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lumi_container.sh b/lumi_container.sh index f6855cd20..9078468e4 100755 --- a/lumi_container.sh +++ b/lumi_container.sh @@ -8,7 +8,7 @@ else PY_PACKAGE="312" fi -if [ ! -f ./container.def ]; then +if [ ! -f ./container.sif ]; then cat << EOF > container.def Bootstrap: docker From: docker.io/opensuse/leap:15.6 From 59413f8df5143528b9bd00666f5f981aaa6b910e Mon Sep 17 00:00:00 2001 From: lassejsc Date: Tue, 26 May 2026 14:53:39 +0300 Subject: [PATCH 6/9] Moving lumi_onctainer to a new folder "containerization", perhaps more can be added later --- lumi_container.sh => containerization/lumi_container.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lumi_container.sh => containerization/lumi_container.sh (100%) diff --git a/lumi_container.sh b/containerization/lumi_container.sh similarity index 100% rename from lumi_container.sh rename to containerization/lumi_container.sh From af55983f21faa7632e5ba3bc560e4ce486d6e2ac Mon Sep 17 00:00:00 2001 From: lassejsc Date: Thu, 28 May 2026 10:06:39 +0300 Subject: [PATCH 7/9] added documentation about binding folders with a friendly warning for the launch script --- containerization/lumi_container.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/containerization/lumi_container.sh b/containerization/lumi_container.sh index 9078468e4..361013bc6 100755 --- a/containerization/lumi_container.sh +++ b/containerization/lumi_container.sh @@ -21,6 +21,9 @@ From: docker.io/opensuse/leap:15.6 # Running: # For example launching python (one can also launch bash for example) # singularity exec container.sif python + # to bind folders once can use --bind /opt,/data:/mnt + # this will bind /opt to /opt and /data to /mnt, alternatively one can use environment variables + # export SINGULARITY_BIND="/opt,/data:/mnt" zypper -n --no-gpg-checks install python$PY_PACKAGE python$PY_PACKAGE-pip python$PY_PACKAGE-setuptools python$PY_PACKAGE-devel git @@ -39,6 +42,9 @@ EOF singularity build container.sif container.def else export PYTHONNOUSERSITE=1 + if [[ ! $SINGULARITY_BIND ]]; then + echo "Friendly reminder: no folders binded to the container, please use SINGULARITY_BIND environment variable" + fi singularity exec container.sif bash fi From d990d354f3e4328066db7a6f5c76af8835e60da2 Mon Sep 17 00:00:00 2001 From: lassejsc Date: Thu, 28 May 2026 10:39:40 +0300 Subject: [PATCH 8/9] Added documentation for the lumi container --- Documentation/sphinx/hpcusage.rst | 14 ++++++++++++++ Documentation/sphinx/index.rst | 1 + containerization/lumi_container.sh | 4 ++++ 3 files changed, 19 insertions(+) create mode 100644 Documentation/sphinx/hpcusage.rst diff --git a/Documentation/sphinx/hpcusage.rst b/Documentation/sphinx/hpcusage.rst new file mode 100644 index 000000000..b097889ca --- /dev/null +++ b/Documentation/sphinx/hpcusage.rst @@ -0,0 +1,14 @@ +Usage in HPC environment +================= + + +LUMI Container +------------------ +Script for building and running a container on LUMI can be found in ``containerization/lumi_container.sh``. + +Simply execute the bash script to build the container, afterwards the same script can be used for launching the container. + +Before building the container set the python version for the container export the environment variable ``PY_VERSION``, which defaults to ``PY_VERSION="3.12"``. + +For binding folders into the container, set the environment variable ``SINGULARITY_BIND`` before running the container. For example, ``export SINGULARITY_BIND="/opt,/data:/mnt"``, this will bind /opt to /opt and /data to /mnt in the container. +For more information on singularity usage, see https://docs.sylabs.io/guides/3.0/user-guide/index.html diff --git a/Documentation/sphinx/index.rst b/Documentation/sphinx/index.rst index fca78f67d..3ca5b28c5 100644 --- a/Documentation/sphinx/index.rst +++ b/Documentation/sphinx/index.rst @@ -24,6 +24,7 @@ analysator documentation analysator analysator_exercises analysator_supported + hpcusage .. toctree:: :maxdepth: 2 diff --git a/containerization/lumi_container.sh b/containerization/lumi_container.sh index 361013bc6..729488daf 100755 --- a/containerization/lumi_container.sh +++ b/containerization/lumi_container.sh @@ -1,5 +1,9 @@ #!/bin/bash #Make container.def +#Usage: +# Simply run this bash script to build the container, be sure to export PY_VERSION to set the python version desired, for example PY_VERSION=3.12 +# After building one can run the script again to launch the container, alternatively call the .sif file directly with singularity +# For binding folders export SINGULARITY_BIND see for example below in # Running: if [[ "$PY_VERSION" ]]; then PY_PACKAGE=$(echo "$PY_VERSION" | sed 's/\.//g' ) From b27d10648454c35c614f4fb9b68c0bdce001a777 Mon Sep 17 00:00:00 2001 From: lassejsc Date: Thu, 28 May 2026 10:48:40 +0300 Subject: [PATCH 9/9] Fixed the whatever sphinx complained about the underline --- Documentation/sphinx/hpcusage.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/sphinx/hpcusage.rst b/Documentation/sphinx/hpcusage.rst index b097889ca..e6447d175 100644 --- a/Documentation/sphinx/hpcusage.rst +++ b/Documentation/sphinx/hpcusage.rst @@ -1,9 +1,9 @@ Usage in HPC environment -================= +======================== LUMI Container ------------------- +-------------- Script for building and running a container on LUMI can be found in ``containerization/lumi_container.sh``. Simply execute the bash script to build the container, afterwards the same script can be used for launching the container.