Skip to content
Snippets Groups Projects
Commit ed06372a authored by Morris Jette's avatar Morris Jette
Browse files

Set CUDA_VISIBLE_DEVICES based upon device file names cached

Based upon work by Nicolas Bigaouette
parent d703d2ec
No related branches found
No related tags found
No related merge requests found
......@@ -109,7 +109,7 @@ const uint32_t plugin_version = 100;
static char gres_name[] = "gpu";
static int *gpu_devices;
static int *gpu_devices = NULL;
static int nb_available_files;
/*
......@@ -199,7 +199,10 @@ extern void job_set_env(char ***job_env_ptr, void *gres_ptr)
dev_list = xmalloc(128);
else
xstrcat(dev_list, ",");
xstrfmtcat(dev_list, "%d", i);
if (gpu_devices && (gpu_devices[i] >= 0))
xstrfmtcat(dev_list, "%d", gpu_devices[i]);
else
xstrfmtcat(dev_list, "%d", i);
}
}
if (dev_list) {
......@@ -236,7 +239,10 @@ extern void step_set_env(char ***job_env_ptr, void *gres_ptr)
dev_list = xmalloc(128);
else
xstrcat(dev_list, ",");
xstrfmtcat(dev_list, "%d", i);
if (gpu_devices && (gpu_devices[i] >= 0))
xstrfmtcat(dev_list, "%d", gpu_devices[i]);
else
xstrfmtcat(dev_list, "%d", i);
}
}
if (dev_list) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment