I am new to singularity containers. I have written a deep learning model by using pytorch to run on a GPU cluster. For that I needed a singularity image.
Singularity version: 3.9.7
Definition file (singularity.def):
Bootstrap: docker From: nvcr.io/nvidia/pytorch:21.10-py3 %post pip install --upgrade pip export PIP_DEFAULT_TIMEOUT=100 /opt/conda/bin/pip install pytorch-lightning /opt/conda/bin/pip install torchmetrics /opt/conda/bin/pip install ujson /opt/conda/bin/pip install captum
I created singularity image by:
sudo singularity build singularity.sif singularity.def
To test if I can use PyTorch I created a simple python file (a.py):
print("Hello") import numpy as np print(np.ones(5)) import torch print(torch.ones(2, 3))
For the convenience I put the singularity image and python file at the same folder at
When I execute the singularity by:
singularity exec --nv -B ~/projects/trial ~/projects/trial/singularity.sif python ~/projects/trial/a.py
I get the following error:
WARNING: Could not find any nv files on this host! "uname": executable file not found in $PATH Hello [1. 1. 1. 1. 1.] OMP: Error #178: Function Can't open SHM2 failed: OMP: System error #30: Read-only file system Aborted
The problem occurs when I import torch. I could not find a solution this problem.
I really appreciate your help.