Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print dlerror if dlopen fails #4485

Merged
merged 2 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion source/api_cc/src/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,13 @@
if (!dso_handle) {
throw deepmd::deepmd_exception(
dso_path +
" is not found! You can add the library directory to LD_LIBRARY_PATH");
" is not found or fails to load! You can add the library directory to "
"LD_LIBRARY_PATH."
#ifndef _WIN32
" Error message: " +
std::string(dlerror())

Check warning on line 397 in source/api_cc/src/common.cc

View check run for this annotation

Codecov / codecov/patch

source/api_cc/src/common.cc#L396-L397

Added lines #L396 - L397 were not covered by tests
#endif
);

Check warning on line 399 in source/api_cc/src/common.cc

View check run for this annotation

Codecov / codecov/patch

source/api_cc/src/common.cc#L399

Added line #L399 was not covered by tests
}
}

Expand Down
4 changes: 4 additions & 0 deletions source/lib/src/gpu/cudart/cudart_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ void *DP_cudart_dlopen(char *libname) {
#endif
if (!dso_handle) {
std::cerr << "DeePMD-kit: Cannot find " << libname << std::endl;
#ifndef _WIN32
std::cerr << "DeePMD-kit: Error message: " << std::string(dlerror())
<< std::endl;
#endif
return nullptr;
}
std::cerr << "DeePMD-kit: Successfully load " << libname << std::endl;
Expand Down
Loading