Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
6f24b6d5
Commit
6f24b6d5
authored
Jul 20, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made the env var CUDA_VISIBLE_DEVICES propagate to the child process
parent
81a40ca7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
subprocess_stream.cpp
dlib/matlab/subprocess_stream.cpp
+13
-2
No files found.
dlib/matlab/subprocess_stream.cpp
View file @
6f24b6d5
...
...
@@ -434,9 +434,20 @@ namespace dlib
stderr_pipe
.
close
();
char
*
argv
[]
=
{(
char
*
)
program_name
,
nullptr
};
char
*
envp
[]
=
{
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
);
}
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment