Skip to content

BSCCNS/MN5_basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MN5 Basics

Setup

1. Install uv

macOS / Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Restart your terminal after installation, then verify:

uv --version

2. Create a virtual environment with Python 3.12

uv venv --python 3.12

This creates a .venv directory in the current folder.


3. Activate the environment

macOS / Linux:

source .venv/bin/activate

Windows:

.venv\Scripts\activate

4. Run the script

python compute_test.py

Running on MN5 with Apptainer

MN5 has no internet access, so containers must be built locally and transferred. Scripts live outside the container and are mounted at runtime — only dependencies are baked in. The Dockerfile is the only container file you need — myenv.def is kept for reference only.

The full workflow is:

Dockerfile → docker build (macOS) → docker save → scp to MN5 → apptainer build → myenv.sif

Step 1 — Build and test locally (macOS)

Scripts live outside the container and are mounted at runtime — only dependencies are baked into the image.

# Build the Docker image for MN5 (amd64 architecture)
docker build --platform linux/amd64 -t myenv .

Step 2 — Export the image as a tarball

docker save myenv -o myenv.tar

Step 3 — Transfer to MN5

Only the tarball needs transferring — scripts can be copied separately or edited directly on MN5.

scp myenv.tar user@mn5.bsc.es:/path/to/project/
scp -r scripts/ user@mn5.bsc.es:/path/to/project/

Step 4 — Convert to .sif on MN5

# Load the Singularity module
module load singularity

# Convert the Docker tar to a Singularity image (no internet needed)
singularity build myenv.sif docker-archive://myenv.tar

Step 5 — Run on MN5

# Mount the local scripts directory and run
singularity run --bind $(pwd)/scripts:/opt/scripts myenv.sif /opt/scripts/compute_test.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors