From 7551cf50e70a43cb89e160f19066c533f83fc8c8 Mon Sep 17 00:00:00 2001 From: vuule Date: Wed, 8 Dec 2021 12:36:54 -0800 Subject: [PATCH] dlopen check; change dlopen mode to avoid a cuFile issue --- cpp/src/io/utilities/file_io_utilities.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cpp/src/io/utilities/file_io_utilities.cpp b/cpp/src/io/utilities/file_io_utilities.cpp index d96bf93d10f..85a5f7e2281 100644 --- a/cpp/src/io/utilities/file_io_utilities.cpp +++ b/cpp/src/io/utilities/file_io_utilities.cpp @@ -75,8 +75,8 @@ class cufile_shim { ~cufile_shim() { - if (driver_close) driver_close(); - if (cf_lib) dlclose(cf_lib); + if (driver_close != nullptr) driver_close(); + if (cf_lib != nullptr) dlclose(cf_lib); } decltype(cuFileHandleRegister)* handle_register = nullptr; @@ -117,7 +117,8 @@ void cufile_shim::modify_cufile_json() const void cufile_shim::load_cufile_lib() { - cf_lib = dlopen("libcufile.so", RTLD_NOW); + cf_lib = dlopen("libcufile.so", RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE); + CUDF_EXPECTS(cf_lib != nullptr, "Failed to load cuFile library"); driver_open = reinterpret_cast(dlsym(cf_lib, "cuFileDriverOpen")); CUDF_EXPECTS(driver_open != nullptr, "could not find cuFile cuFileDriverOpen symbol"); driver_close = reinterpret_cast(dlsym(cf_lib, "cuFileDriverClose"));