File tree Expand file tree Collapse file tree
cuda_bindings/cuda/bindings/_bindings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,18 +47,24 @@ cdef bint __cuPythonInit = False
4747{{if 'nvrtcSetFlowCallback' in found_functions}}cdef void *__nvrtcSetFlowCallback = NULL{{endif}}
4848
4949cdef 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')
You can’t perform that action at this time.
0 commit comments