Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Singularity Documentation: https://docs.sylabs.io/guides/latest/user-guide/

Table of Contents

Table of Contents


Initial account setup

  1. Create an account on sylabs (via google/ucar email)
  2. Generate access token - once Once logged in, got go to the top right in the drop down menu under your user name and click "Access Tokens". Enter a label/alias, ie "Hercules", and click "Create Access Token". You will be prompted for this token when you first create a container using the --remote  option. 

...

In order to build a container on a remote host or HPC, you need to use the the --remote  flag since we typically do not have admin privileges. An example build command using the definition file above on Hercules is: singularity build --remote wb_container.sif /work2/noaa/jcsda/agriffin/JEDI_WB/wb_container/wb_container.def 


Running a container

Running a container is done by using the singularity exec  command. The singularity exec  command will run a specific command against an instance. An example of how we can use this inside an EWOK task is the line in the runtime file for weather bench scores (src/runtime/wbScoresRun.sh):

Code Block
titleRunning singularity container
singularity exec -B $WORKDIR:/$WORKDIR -B $JEDI_WORKFLOW:/jedi-workflow -B /work2/noaa/jcsda/cgas/jedi/wb_files:/work2/noaa/jcsda/cgas/jedi/wb_files /work2/noaa/jcsda/agriffin/JEDI_WB/wb_container/wb_container

...

.sif bash -c "cd $WORKDIR && python3 /jedi-workflow/ewok/src/runtime/evaluation_deterministic.py"

Note, -B  will "bind"/mount the directories you need onto the container. 

Note, you can also run singularity shell work2/noaa/jcsda/agriffin/JEDI_WB/wb_container/wb_container.sif  to spawn a new shell within your container.TODO