Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3a44bb7 commit 2490352Copy full SHA for 2490352
test/test_cuda.py
@@ -3405,7 +3405,8 @@ def check_output(script: str) -> str:
3405
# Check that `cuInit` was not called during the import
3406
# By using ctypes and calling cuDeviceCountGet() and expect CUDA_ERROR_NOT_INITIALIZED == 3
3407
# See https://github.com/pytorch/pytorch/issues/116276 for more details
3408
- cuda_driver_api_call = "ctypes.CDLL('libcuda.so.1').cuDeviceGetCount(ctypes.byref(x))"
+ libcuda_name = "libcuda.so.1" if not IS_WINDOWS else "nvcuda.dll"
3409
+ cuda_driver_api_call = f"ctypes.CDLL('{libcuda_name}').cuDeviceGetCount(ctypes.byref(x))"
3410
rc = check_output(f"import torch; import ctypes;x=ctypes.c_int(-1);print({cuda_driver_api_call})")
3411
self.assertEqual(rc, "3")
3412
0 commit comments