Skip to content

Commit aedfbb7

Browse files
mrrytensorflower-gardener
authored andcommitted
Move usage of dlfcn.h into the platform/posix subdirectory.
Switch the CUPTI wrapper to use Env::Default() functions for resolving symbols in libraries. Change: 134303329
1 parent 4da7faf commit aedfbb7

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

tensorflow/contrib/makefile/proto_text_cc_files.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tensorflow/core/platform/posix/posix_file_system.cc
88
tensorflow/core/platform/posix/port.cc
99
tensorflow/core/platform/posix/error.cc
1010
tensorflow/core/platform/posix/env.cc
11-
tensorflow/core/platform/load_library.cc
11+
tensorflow/core/platform/posix/load_library.cc
1212
tensorflow/core/platform/file_system.cc
1313
tensorflow/core/platform/env.cc
1414
tensorflow/core/platform/denormal.cc

tensorflow/core/platform/default/gpu/cupti_wrapper.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ limitations under the License.
1717

1818
#if GOOGLE_CUDA
1919

20-
#include <dlfcn.h>
2120
#include <string>
2221

22+
#include "tensorflow/core/platform/env.h"
2323
#include "tensorflow/core/platform/stream_executor.h"
2424

2525
namespace perftools {
@@ -38,9 +38,10 @@ namespace dynload {
3838
return status.ValueOrDie(); \
3939
} \
4040
static FuncPointerT DynLoad() { \
41-
static void* f = dlsym(GetDsoHandle(), kName); \
42-
CHECK(f != nullptr) << "could not find " << kName \
43-
<< "in libcupti DSO; dlerror: " << dlerror(); \
41+
static void* f; \
42+
TF_CHECK_OK(::tensorflow::Env::Default()->GetSymbolFromLibrary( \
43+
GetDsoHandle(), kName, &f)) \
44+
<< "could not find " << kName << "in libcupti DSO"; \
4445
return reinterpret_cast<FuncPointerT>(f); \
4546
} \
4647
template <typename... Args> \

tensorflow/core/platform/load_library.cc renamed to tensorflow/core/platform/posix/load_library.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
#include "tensorflow/core/platform/load_library.h"
17+
1618
#include <dlfcn.h>
1719

1820
#include "tensorflow/core/lib/core/errors.h"

0 commit comments

Comments
 (0)