Skip to content

Commit

Permalink
dlopen check; change dlopen mode to avoid a cuFile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vuule committed Dec 8, 2021
1 parent a72f19e commit 7551cf5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cpp/src/io/utilities/file_io_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<decltype(driver_open)>(dlsym(cf_lib, "cuFileDriverOpen"));
CUDF_EXPECTS(driver_open != nullptr, "could not find cuFile cuFileDriverOpen symbol");
driver_close = reinterpret_cast<decltype(driver_close)>(dlsym(cf_lib, "cuFileDriverClose"));
Expand Down

0 comments on commit 7551cf5

Please sign in to comment.