X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7519cf2beb1d81ce578dd2ef0624d77b9588ce70..9696c090dbf9dd777fc0a2c8925c67093503d5dc:/lib/crunchrun/singularity.go diff --git a/lib/crunchrun/singularity.go b/lib/crunchrun/singularity.go index cda10aa611..64a3773250 100644 --- a/lib/crunchrun/singularity.go +++ b/lib/crunchrun/singularity.go @@ -284,6 +284,15 @@ func (e *singularityExecutor) execCmd(path string) *exec.Cmd { env = append(env, "SINGULARITYENV_"+k+"="+v) } + // Singularity always makes all nvidia devices visible to the + // container. If a resource manager such as slurm or LSF told + // us to select specific devices we need to propagate that. + if cudaVisibleDevices := os.Getenv("CUDA_VISIBLE_DEVICES"); cudaVisibleDevices != "" { + // If a resource manager such as slurm or LSF told + // us to select specific devices we need to propagate that. + env = append(env, "SINGULARITYENV_CUDA_VISIBLE_DEVICES="+cudaVisibleDevices) + } + args = append(args, e.imageFilename) args = append(args, e.spec.Command...)