Skip to content

Commit 3be0e1c

Browse files
malfetpytorchmergebot
authored andcommitted
c10::DriverAPI Try opening libcuda.so.1 (pytorch#112996)
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 Also, change `TORCH_INTERNAL_ASSERT` to `TORCH_CHECK` as one can legitimate fail to open one, if driver could not be found. Fixes pytorch#112957 Pull Request resolved: pytorch#112996 Approved by: https://github.com/kit1980, https://github.com/Skylion007 ghstack dependencies: pytorch#112994, pytorch#112995
1 parent d0a80f8 commit 3be0e1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

c10/cuda/driver_api.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace cuda {
1010
namespace {
1111

1212
DriverAPI create_driver_api() {
13-
void* handle_0 = dlopen("libcuda.so", RTLD_LAZY | RTLD_NOLOAD);
14-
TORCH_INTERNAL_ASSERT(handle_0, "Can't open libcuda.so: ", dlerror());
13+
void* handle_0 = dlopen("libcuda.so.1", RTLD_LAZY | RTLD_NOLOAD);
14+
TORCH_CHECK(handle_0, "Can't open libcuda.so.1: ", dlerror());
1515
void* handle_1 = DriverAPI::get_nvml_handle();
1616
DriverAPI r{};
1717

0 commit comments

Comments
 (0)