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 1 commit
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
6 changes: 5 additions & 1 deletion source/api_cc/src/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ static inline void _load_library_path(std::string dso_path) {
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())
#endif
);
}
}

Expand Down
3 changes: 3 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,9 @@ 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