Skip to content

Commit 7d57c0f

Browse files
committed
Simplify gil handling
1 parent dcbf2f5 commit 7d57c0f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

cuda_bindings/cuda/bindings/cyruntime.pyx.in

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,20 +1898,18 @@ cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCa
18981898
with gil:
18991899
lib = load_nvidia_dynamic_lib("cudart")
19001900
filename = Path(lib.abs_path).name
1901-
handle = <void *><uintptr_t>lib._handle_uint
1901+
handle = <void *><uintptr_t>(lib._handle_uint)
19021902

1903-
{{if 'Windows' == platform.system()}}
1904-
with gil:
1903+
{{if 'Windows' == platform.system()}}
19051904
try:
19061905
__cudaRuntimeGetVersion = <void*><unsigned long long>win32api.GetProcAddress(<uintptr_t>handle, 'cudaRuntimeGetVersion')
19071906
except:
19081907
pass
1909-
{{else}}
1910-
__cudaRuntimeGetVersion = dlfcn.dlsym(handle, 'cudaRuntimeGetVersion')
1911-
{{endif}}
1908+
{{else}}
1909+
__cudaRuntimeGetVersion = dlfcn.dlsym(handle, 'cudaRuntimeGetVersion')
1910+
{{endif}}
19121911

1913-
if __cudaRuntimeGetVersion == NULL:
1914-
with gil:
1912+
if __cudaRuntimeGetVersion == NULL:
19151913
raise RuntimeError(f'Function "cudaRuntimeGetVersion" not found in {filename}')
19161914

19171915
cdef cudaError_t err = cudaSuccess

0 commit comments

Comments
 (0)