Commit 41d261ac authored by Davis King's avatar Davis King

merged

parents d0fae991 6f24b6d5
......@@ -434,9 +434,20 @@ namespace dlib
stderr_pipe.close();
char* argv[] = {(char*)program_name, nullptr};
char* cudadevs = getenv("CUDA_VISIBLE_DEVICES");
if (cudadevs)
{
std::string extra = std::string("CUDA_VISIBLE_DEVICES=") + cudadevs;
char* envp[] = {(char*)extra.c_str(), nullptr};
execve(argv[0], argv, envp);
}
else
{
char* envp[] = {nullptr};
execve(argv[0], argv, envp);
}
// If launching the child didn't work then bail immediately so the parent
// process has no chance to get tweaked out (*cough* MATLAB *cough*).
_Exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment