RCS provides a Singularity container to run jobs and programs using the CentOS 7 environment. This provides the exact set of modules, filesystem, and system libraries that were available on the SCC under CentOS 7.
Sections
- Running the CentOS 7 Singularity Container
- Submitting Your CentOS 7 Jobs
- Migrating Conda Environments to AlmaLinux 8
Running the CentOS 7 Singularity Container
The container can be run interactively, to run scripts, or as part of running jobs on the SCC via the queue. A script, scc-centos7
, is provided to help run the container. To run the container interactively, just enter the name of the script. Here the interactive shell is started, and the file /etc/os-release
is checked to demonstrate that the container is indeed running CentOS 7. Note that the shell prompt is different than the usual one on the SCC:
scc1% scc-centos7
Singularity> grep "CentOS Linux" /etc/os-release
NAME="CentOS Linux"
PRETTY_NAME="CentOS Linux 7 (Core)"
Singularity> module avail openblas
------------ /share/module.7/programming ------------
openblas/0.2.20 openblas/0.3.7
openblas/0.3.13 openblas/0.3.17 (D)
Where:
D: Default Module
If the avail list is too long consider trying:
"module --default avail" or "ml -d av" to just list the default modules.
"module overview" or "ml ov" to display the number of modules for each name.
Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
Singularity>
Singularity> exit
Modules from CentOS 7 can be loaded normally when running the container, either interactively or when using the container to run a script. Any CentOS 7 modules that are not available on Alma8 will still print warning messages, but they can be ignored.
The container can also be used to run a script. The script will execute in the CentOS 7 environment:
scc1% scc-centos7 < my_script.sh
Submitting Your CentOS 7 Jobs
Job scripts can be run using the CentOS 7 container with the creation of an extra job script. This is best explained via an example. Here is a simple job script that runs a Python program, with 4 cores and a maximum job time of 24 hours. This job script is called run_calc.qsub
:
#!/bin/bash -l
#$ -pe omp 4
#$ -l h_rt=24:00:00
module load python3/3.8.10
python run_calc.py
To run this using the CentOS 7 Singularity container, a second job script is created. The qsub options from the original job script are copied over, and the original script is executed by scc-centos7
. This new job script is called run_calc_cos7.qsub
:
#!/bin/bash -l
#$ -pe omp 4
#$ -l h_rt=24:00:00
scc-centos7 < run_calc.qsub
After the run_calc_cos7.qsub
script has been created, it is submitted to the queue in the usual fashion:
scc1% qsub run_calc_cos7.qsub
Migrating Conda Environments to AlmaLinux 8
If you find that one of your conda environments is not functioning under Alma8, you can use the container as part of the process to re-create the conda environment under Alma8. This may correct any conda environment issues you are encountering. The steps here are similar to those used when moving a conda environment from your home directory to your project space.
First, start up the CentOS 7 container interactively, and export the list of installed packages from your environment:
scc1% scc-centos7
Singularity> module load miniconda
Singularity> conda activate my_env1
(my_env1) Singularity> conda list --explicit > my_env1_cos7_pkgs.txt
Singularity> exit
On Alma8, you then re-create that environment:
scc1% module load miniconda
scc1% conda create --name my_env2 --file my_env1_cos7_pkgs.txt
scc1% conda activate my_env2