Singularity: what's the purpose of --nv used

Created on 10 Feb 2018  路  3Comments  路  Source: hpcng/singularity

I have one image test.img which contains the cuda driver and library. These are 2 ways to use the image.
singularity shell test.img
singularity shell --nv test.img
I found both 2 way can use gpu in the image, so the questions is what's the purpose of the --nv.

Most helpful comment

Hi @zhcf. Good question.

If you install the libraries from the nvidia driver (like the contents of this run file) into your container than you can use the GPU on the host system. But ONLY if the host system has the exact same driver installed. That is because the driver libraries installed in the container must match the driver kernel module installed on the host system. So this works, but it breaks portability.

With the --nv option the driver libs are located on the host system and then bind mounted into the container at runtime. This means you can run your container on a host with one version of the nvidia driver, and then move the same container to another host with a different version of the nivida driver and both will work. (Assuming the cuda installed in your container is compatible with both drivers.)

Check https://github.com/singularityware/singularity/issues/1253 for more details. 馃槃

All 3 comments

Hi @zhcf. Good question.

If you install the libraries from the nvidia driver (like the contents of this run file) into your container than you can use the GPU on the host system. But ONLY if the host system has the exact same driver installed. That is because the driver libraries installed in the container must match the driver kernel module installed on the host system. So this works, but it breaks portability.

With the --nv option the driver libs are located on the host system and then bind mounted into the container at runtime. This means you can run your container on a host with one version of the nvidia driver, and then move the same container to another host with a different version of the nivida driver and both will work. (Assuming the cuda installed in your container is compatible with both drivers.)

Check https://github.com/singularityware/singularity/issues/1253 for more details. 馃槃

Thank you GodloveD. It is helpful.

Great. If you need anything else feel free to reopen.

Was this page helpful?
0 / 5 - 0 ratings