Skip to content

Commit 0d5977b

Browse files
committed
nvrtc changes as produced by cython-gen
1 parent 9364e42 commit 0d5977b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,24 @@ cdef bint __cuPythonInit = False
4747
{{if 'nvrtcSetFlowCallback' in found_functions}}cdef void *__nvrtcSetFlowCallback = NULL{{endif}}
4848

4949
cdef int cuPythonInit() except -1 nogil:
50-
{{if 'Windows' != platform.system()}}
51-
cdef void* handle = NULL
52-
{{endif}}
53-
5450
global __cuPythonInit
5551
if __cuPythonInit:
5652
return 0
5753
__cuPythonInit = True
5854

55+
# Load library
5956
{{if 'Windows' == platform.system()}}
6057
with gil:
6158
handle = path_finder._load_nvidia_dynamic_library("nvrtc").handle
59+
{{else}}
60+
with gil:
61+
handle = <void*><uintptr_t>path_finder._load_nvidia_dynamic_library("nvrtc").handle
62+
{{endif}}
63+
64+
65+
# Load function
66+
{{if 'Windows' == platform.system()}}
67+
with gil:
6268
{{if 'nvrtcGetErrorString' in found_functions}}
6369
try:
6470
global __nvrtcGetErrorString
@@ -243,8 +249,6 @@ cdef int cuPythonInit() except -1 nogil:
243249
{{endif}}
244250

245251
{{else}}
246-
with gil:
247-
handle = <void*><uintptr_t>path_finder._load_nvidia_dynamic_library("nvrtc").handle
248252
{{if 'nvrtcGetErrorString' in found_functions}}
249253
global __nvrtcGetErrorString
250254
__nvrtcGetErrorString = dlfcn.dlsym(handle, 'nvrtcGetErrorString')

0 commit comments

Comments
 (0)