diff options
author | Patrick Nguyen <drpng@google.com> | 2016-10-20 12:09:18 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-10-20 13:19:03 -0700 |
commit | c5ab3dd177dc16bb211821e38219f350a613b5e8 (patch) | |
tree | 69f38f2790f85f31dae60b6b7c6b136b3b380daa /tensorflow/stream_executor/dso_loader.cc | |
parent | 8532897352ada1d8ecd3ca1dd17aaa869a42d4b8 (diff) |
Merge changes from github.
Change: 136750267
Diffstat (limited to 'tensorflow/stream_executor/dso_loader.cc')
-rw-r--r-- | tensorflow/stream_executor/dso_loader.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tensorflow/stream_executor/dso_loader.cc b/tensorflow/stream_executor/dso_loader.cc index 4a96b048c4..c9b305a32a 100644 --- a/tensorflow/stream_executor/dso_loader.cc +++ b/tensorflow/stream_executor/dso_loader.cc @@ -29,9 +29,9 @@ limitations under the License. #include <vector> #include "tensorflow/core/platform/load_library.h" +#include "tensorflow/stream_executor/lib/env.h" #include "tensorflow/stream_executor/lib/error.h" #include "tensorflow/stream_executor/lib/str_util.h" -#include "tensorflow/stream_executor/lib/str_util.h" #include "tensorflow/stream_executor/lib/strcat.h" #include "tensorflow/stream_executor/lib/stringprintf.h" #include "tensorflow/stream_executor/platform/logging.h" @@ -97,19 +97,23 @@ string GetCudnnVersion() { return TF_CUDNN_VERSION; } /* static */ port::Status DsoLoader::GetDsoHandle(port::StringPiece path, void** dso_handle, LoadKind load_kind) { + if (load_kind != LoadKind::kLocal) { + return port::Status(port::error::INVALID_ARGUMENT, + "Only LoadKind::kLocal is currently supported"); + } int dynload_flags = RTLD_LAZY | (load_kind == LoadKind::kLocal ? RTLD_LOCAL : RTLD_GLOBAL); string path_string = path.ToString(); - *dso_handle = dlopen(path_string.c_str(), dynload_flags); - if (*dso_handle == nullptr) { + port::Status s = + port::Env::Default()->LoadLibrary(path_string.c_str(), dso_handle); + if (!s.ok()) { LOG(INFO) << "Couldn't open CUDA library " << path << ". LD_LIBRARY_PATH: " << getenv("LD_LIBRARY_PATH"); - return port::Status( - port::error::FAILED_PRECONDITION, - port::StrCat("could not dlopen DSO: ", path, "; dlerror: ", dlerror())); + return port::Status(port::error::FAILED_PRECONDITION, + port::StrCat("could not dlopen DSO: ", path, + "; dlerror: ", s.error_message())); } - LOG(INFO) << "successfully opened CUDA library " << path - << (load_kind == LoadKind::kLocal ? " locally" : " globally"); + LOG(INFO) << "successfully opened CUDA library " << path << " locally"; return port::Status::OK(); } |