Skip to content

Commit f58669b

Browse files
authored
c10::DriverAPI Try opening libcuda.so.1 (pytorch#113096)
As `libcuda.so` is only installed on dev environment (i.e. when CUDAToolkit is installed), while `libcuda.so.1` is part of NVIDIA driver. Also, this will keep it aligned with https://github.com/pytorch/pytorch/blob/a5cb8f75a7f991212fbc6d049e0bc2f9f48b07f8/aten/src/ATen/cuda/detail/LazyNVRTC.cpp#L16 Better errors in `c10::DriverAPI` on `dlopn`/`dlsym` failures Cherry-pick of following PR into release/2.1 branch - Better errors in `c10::DriverAPI` on `dl` failure (pytorch#112995) - `c10::DriverAPI` Try opening libcuda.so.1 (pytorch#112996) (cherry picked from commit 3be0e1c) (cherry picked from commit d0a80f8)
1 parent 33106b7 commit f58669b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

c10/cuda/driver_api.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ namespace {
1010
DriverAPI create_driver_api() {
1111
#define OPEN_LIBRARIES(name, n) \
1212
void* handle_##n = dlopen(name, RTLD_LAZY); \
13-
TORCH_INTERNAL_ASSERT(handle_##n);
13+
TORCH_INTERNAL_ASSERT(handle_##n, "Can't open ", #name, ": ", dlerror());
1414

1515
C10_FORALL_DRIVER_LIBRARIES(OPEN_LIBRARIES)
1616
#undef OPEN_LIBRARIES
1717
DriverAPI r{};
1818

1919
#define LOOKUP_ENTRY(name, n) \
2020
r.name##_ = ((decltype(&name))dlsym(handle_##n, #name)); \
21-
TORCH_INTERNAL_ASSERT(r.name##_)
21+
TORCH_INTERNAL_ASSERT(r.name##_, "Can't find ", #name, ": ", dlerror())
2222
C10_FORALL_DRIVER_API(LOOKUP_ENTRY)
2323
#undef LOOKUP_ENTRY
2424
return r;

c10/cuda/driver_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
} while (0)
2020

2121
#define C10_FORALL_DRIVER_LIBRARIES(_) \
22-
_("libcuda.so", 0) \
22+
_("libcuda.so.1", 0) \
2323
_("libnvidia-ml.so.1", 1)
2424

2525
#define C10_FORALL_DRIVER_API(_) \

0 commit comments

Comments
 (0)