Overview
Singularity (now Apptainer) is an alternative to Docker commonly used in HPC environments. AlphaFold 3 can run in Singularity containers built from Docker images.You still need to build the Docker image first, then convert it to Singularity format.
Prerequisites
1
Docker Installed
Required to build the initial Docker image
2
Singularity Installed
Version 3.3+ or Apptainer
3
NVIDIA GPU
With drivers installed on host
4
Databases Downloaded
Same databases as Docker setup
Installation
Installing Singularity
- Ubuntu 22.04
- From Source
Download and install the Singularity package:Verify installation:
Building Singularity Image
Step 1: Build Docker Image
First, build the AlphaFold 3 Docker image:Step 2: Start Local Docker Registry
Singularity pulls from a Docker registry:Step 3: Push to Local Registry
Step 4: Build Singularity Image
This creates
alphafold3.sif, a single file containing the entire container.Step 5: Verify Build
Test GPU access:Running AlphaFold 3
Basic Usage
The Singularity command structure:flag
required
Enable NVIDIA GPU support
mount
Mount host directories into container (equivalent to Docker’s
--volume)Complete Example
Multiple Database Directories
For SSD + HDD setup:Running in Stages
Data Pipeline Only (CPU)
No
--nv flag needed for CPU-only data pipeline.Inference Only (GPU)
HPC Integration
SLURM Example
Create a SLURM batch script:slurm_alphafold.sh
PBS Example
pbs_alphafold.sh
Array Jobs for Multiple Inputs
slurm_array.sh
Singularity vs Docker
Advantages of Singularity
No Root Required
Runs without root privileges, suitable for HPC
Single File
.sif file is portable and easy to distributeHPC Integration
Works with SLURM, PBS, and other schedulers
Performance
Lower overhead on shared filesystems
Key Differences
Troubleshooting
GPU Not Detected
Bind Mount Errors
Permission Issues
Memory Issues
Build Failures
Interactive Shell
For debugging, open an interactive shell:Advanced Options
Writable Container
Create a writable sandbox:Custom Environment Variables
Network Access
Distribution
The.sif file is self-contained and portable:
The
.sif file is typically 5-10 GB. Ensure sufficient transfer bandwidth and storage.Next Steps
Docker Guide
Compare with Docker setup
Performance
Optimize for HPC environments