Introduction to Singularity
Singularity is a containerization platform that allows users to run applications in isolated environments, ensuring reproducibility across different computing systems. It is widely used for scientific computing and high-performance computing (HPC) environments like SeaWulf.
Containers are self-contained execution environments that package software, libraries, and dependencies. This allows users to run applications without worrying about compatibility issues with the underlying system. One of the key benefits of Singularity is its ability to ensure reproducibility of research - by encapsulating your entire environment in a container, you can ensure that your research code runs the same way on different systems, regardless of software or hardware differences.
Obtaining Singularity Containers
Building Singularity containers from definition files requires elevated privileges (sudo or --fakeroot) that are not available on SeaWulf. Instead, you should build containers on your local machine or use pre-built container images from repositories.
Important: The singularity build command with definition files is not supported on SeaWulf due to privilege requirements. Build your containers locally before transferring them to SeaWulf.
Option 1: Pull Pre-built Containers
You can pull pre-built containers from online repositories such as Docker Hub or Singularity Library. This is the recommended approach for most users:
The pulled images will be saved as .sif files in your current directory.
Option 2: Build Locally and Transfer
If you need a custom container, build it on your local machine (where you have sudo access) and then transfer the .sif file to SeaWulf:
Running a Singularity Container
Once you have a container, you can run it using the singularity run command.
This command will execute the default command specified in the container image. To run a custom command inside the container, use the exec option:
Note: Ensure that your container image is properly configured for the task you want to execute. Singularity supports both interactive and non-interactive commands.
Example: Running a Python Script in a Singularity Container
To run a Python script inside your Singularity container, use the following command:
This command runs the my_script.py Python script using Python 3 inside the container.
