File tree Expand file tree Collapse file tree 2 files changed +6
-18
lines changed
cuda_bindings/cuda/bindings/_internal Expand file tree Collapse file tree 2 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -39,35 +39,29 @@ cdef void* __nvJitLinkGetInfoLog = NULL
39
39
cdef void * __nvJitLinkVersion = NULL
40
40
41
41
42
- cdef void * load_library(int driver_ver) except * with gil:
43
- cdef intptr_t handle = path_finder._load_nvidia_dynamic_library(" nvJitLink" ).handle
44
- return < void * > handle
45
-
46
-
47
42
cdef int _check_or_init_nvjitlink() except - 1 nogil:
48
43
global __py_nvjitlink_init
49
44
if __py_nvjitlink_init:
50
45
return 0
51
46
52
47
cdef int err, driver_ver
53
- cdef intptr_t handle
54
48
with gil:
55
49
# Load driver to check version
56
50
try :
57
- nvcuda_handle = win32api.LoadLibraryEx(" nvcuda.dll" , 0 , LOAD_LIBRARY_SEARCH_SYSTEM32)
51
+ handle = win32api.LoadLibraryEx(" nvcuda.dll" , 0 , LOAD_LIBRARY_SEARCH_SYSTEM32)
58
52
except Exception as e:
59
53
raise NotSupportedError(f' CUDA driver is not found ({e})' )
60
54
global __cuDriverGetVersion
61
55
if __cuDriverGetVersion == NULL :
62
- __cuDriverGetVersion = < void * >< intptr_t> win32api.GetProcAddress(nvcuda_handle , ' cuDriverGetVersion' )
56
+ __cuDriverGetVersion = < void * >< intptr_t> win32api.GetProcAddress(handle , ' cuDriverGetVersion' )
63
57
if __cuDriverGetVersion == NULL :
64
58
raise RuntimeError (' something went wrong' )
65
59
err = (< int (* )(int * ) noexcept nogil> __cuDriverGetVersion)(& driver_ver)
66
60
if err != 0 :
67
61
raise RuntimeError (' something went wrong' )
68
62
69
63
# Load library
70
- handle = < intptr_t > load_library(driver_ver)
64
+ handle = path_finder._load_nvidia_dynamic_library( " nvJitLink " ).handle
71
65
72
66
# Load function
73
67
global __nvJitLinkCreate
Original file line number Diff line number Diff line change @@ -37,35 +37,29 @@ cdef void* __nvvmGetProgramLogSize = NULL
37
37
cdef void * __nvvmGetProgramLog = NULL
38
38
39
39
40
- cdef void * load_library(int driver_ver) except * with gil:
41
- cdef intptr_t handle = path_finder._load_nvidia_dynamic_library(" nvvm" ).handle
42
- return < void * > handle
43
-
44
-
45
40
cdef int _check_or_init_nvvm() except - 1 nogil:
46
41
global __py_nvvm_init
47
42
if __py_nvvm_init:
48
43
return 0
49
44
50
45
cdef int err, driver_ver
51
- cdef intptr_t handle
52
46
with gil:
53
47
# Load driver to check version
54
48
try :
55
- nvcuda_handle = win32api.LoadLibraryEx(" nvcuda.dll" , 0 , LOAD_LIBRARY_SEARCH_SYSTEM32)
49
+ handle = win32api.LoadLibraryEx(" nvcuda.dll" , 0 , LOAD_LIBRARY_SEARCH_SYSTEM32)
56
50
except Exception as e:
57
51
raise NotSupportedError(f' CUDA driver is not found ({e})' )
58
52
global __cuDriverGetVersion
59
53
if __cuDriverGetVersion == NULL :
60
- __cuDriverGetVersion = < void * >< intptr_t> win32api.GetProcAddress(nvcuda_handle , ' cuDriverGetVersion' )
54
+ __cuDriverGetVersion = < void * >< intptr_t> win32api.GetProcAddress(handle , ' cuDriverGetVersion' )
61
55
if __cuDriverGetVersion == NULL :
62
56
raise RuntimeError (' something went wrong' )
63
57
err = (< int (* )(int * ) noexcept nogil> __cuDriverGetVersion)(& driver_ver)
64
58
if err != 0 :
65
59
raise RuntimeError (' something went wrong' )
66
60
67
61
# Load library
68
- handle = < intptr_t > load_library(driver_ver)
62
+ handle = path_finder._load_nvidia_dynamic_library( " nvvm " ).handle
69
63
70
64
# Load function
71
65
global __nvvmVersion
You can’t perform that action at this time.
0 commit comments