Commit 5ecd904d authored by Davis King's avatar Davis King

merged

parents cf321559 fd6db821
...@@ -54,7 +54,7 @@ INCLUDE_DIRECTORIES("${dlib_matlab_binding_path}") ...@@ -54,7 +54,7 @@ INCLUDE_DIRECTORIES("${dlib_matlab_binding_path}")
# Also add dlib to the include search path # Also add dlib to the include search path
INCLUDE_DIRECTORIES(${dlib_matlab_binding_path}/../..) INCLUDE_DIRECTORIES(${dlib_matlab_binding_path}/../..)
include(${dlib_matlab_binding_path}/../add_global_compiler_switch.cmake) include(${dlib_matlab_binding_path}/../cmake_utils/add_global_compiler_switch.cmake)
add_global_define(MATLAB_MEX_FILE) add_global_define(MATLAB_MEX_FILE)
# Determine the path to our CMakeLists.txt file. This is the file that # Determine the path to our CMakeLists.txt file. This is the file that
......
This diff is collapsed.
...@@ -434,9 +434,20 @@ namespace dlib ...@@ -434,9 +434,20 @@ namespace dlib
stderr_pipe.close(); stderr_pipe.close();
char* argv[] = {(char*)program_name, nullptr}; 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}; 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 // If launching the child didn't work then bail immediately so the parent
// process has no chance to get tweaked out (*cough* MATLAB *cough*). // process has no chance to get tweaked out (*cough* MATLAB *cough*).
_Exit(1); _Exit(1);
......
...@@ -1174,8 +1174,8 @@ namespace dlib ...@@ -1174,8 +1174,8 @@ namespace dlib
{ {
#ifdef MATLAB_MEX_FILE #ifdef MATLAB_MEX_FILE
// You can't move memory around when compiled in a matlab mex file and the // You can't move memory around when compiled in a matlab mex file and the
// different locations have different persistence settings. // different locations have different ownership settings.
if (data._private_is_persistent() == item.data._private_is_persistent()) if (data._private_is_owned_by_matlab() == item.data._private_is_owned_by_matlab())
{ {
swap(item); swap(item);
} }
...@@ -1195,8 +1195,8 @@ namespace dlib ...@@ -1195,8 +1195,8 @@ namespace dlib
{ {
#ifdef MATLAB_MEX_FILE #ifdef MATLAB_MEX_FILE
// You can't move memory around when compiled in a matlab mex file and the // You can't move memory around when compiled in a matlab mex file and the
// different locations have different persistence settings. // different locations have different ownership settings.
if (data._private_is_persistent() == rhs.data._private_is_persistent()) if (data._private_is_owned_by_matlab() == rhs.data._private_is_owned_by_matlab())
{ {
swap(rhs); swap(rhs);
} }
...@@ -1343,14 +1343,14 @@ namespace dlib ...@@ -1343,14 +1343,14 @@ namespace dlib
return data._private_release_mxArray(); return data._private_release_mxArray();
} }
void _private_mark_non_persistent() void _private_mark_owned_by_matlab()
{ {
data._private_mark_non_persistent(); data._private_mark_owned_by_matlab();
} }
bool _private_is_persistent() bool _private_is_owned_by_matlab()
{ {
return data._private_is_persistent(); return data._private_is_owned_by_matlab();
} }
#endif #endif
......
This diff is collapsed.
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