@@ -12,9 +12,10 @@ cimport cuda.bindings._lib.dlfcn as dlfcn
1212from libc.stdint cimport intptr_t
1313import os
1414import sys
15- import threading
1615cimport cuda.bindings._bindings.loader as loader
17- cdef object __symbol_lock = threading.RLock()
16+ import threading
17+
18+ cdef object __symbol_lock = threading.Lock()
1819cdef bint __cuPythonInit = False
1920{{if 'cuGetErrorString' in found_functions}}cdef void *__cuGetErrorString = NULL{{endif}}
2021{{if 'cuGetErrorName' in found_functions}}cdef void *__cuGetErrorName = NULL{{endif}}
@@ -510,7 +511,7 @@ cdef int _cuPythonInit() except -1 nogil:
510511 {{else}}
511512 path = 'libcuda.so.1'
512513 {{endif}}
513-
514+
514515 {{if 'Windows' == platform.system()}}
515516 LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800
516517 try:
@@ -522,7 +523,7 @@ cdef int _cuPythonInit() except -1 nogil:
522523 if (handle == NULL):
523524 raise RuntimeError('Failed to dlopen ' + path)
524525 {{endif}}
525-
526+
526527 # Get latest __cuGetProcAddress_v2
527528 global __cuGetProcAddress_v2
528529 {{if 'Windows' == platform.system()}}
@@ -533,7 +534,7 @@ cdef int _cuPythonInit() except -1 nogil:
533534 {{else}}
534535 __cuGetProcAddress_v2 = dlfcn.dlsym(handle, 'cuGetProcAddress_v2')
535536 {{endif}}
536-
537+
537538 # Load using cuGetProcAddress if available
538539 if __cuGetProcAddress_v2 != NULL:
539540 _F_cuGetProcAddress_v2 = <__cuGetProcAddress_v2_T>__cuGetProcAddress_v2
@@ -2760,10 +2761,9 @@ cdef int _cuPythonInit() except -1 nogil:
27602761 global __cuGraphicsVDPAURegisterOutputSurface
27612762 _F_cuGetProcAddress_v2('cuGraphicsVDPAURegisterOutputSurface', &__cuGraphicsVDPAURegisterOutputSurface, 3010, CU_GET_PROC_ADDRESS_DEFAULT, NULL)
27622763 {{endif}}
2763-
27642764 __cuPythonInit = True
27652765 return 0
2766-
2766+
27672767 {{if 'Windows' == platform.system()}}
27682768 # Load using win32GetAddr
27692769 if usePTDS:
@@ -8877,7 +8877,6 @@ cdef int _cuPythonInit() except -1 nogil:
88778877 __cuGraphicsVDPAURegisterOutputSurface = dlfcn.dlsym(handle, 'cuGraphicsVDPAURegisterOutputSurface')
88788878 {{endif}}
88798879 {{endif}}
8880-
88818880 __cuPythonInit = True
88828881 return 0
88838882
@@ -8886,7 +8885,6 @@ cdef int _cuPythonInit() except -1 nogil:
88868885cdef inline int cuPythonInit() except -1 nogil:
88878886 if __cuPythonInit:
88888887 return 0
8889-
88908888 return _cuPythonInit()
88918889
88928890{{if 'cuGetErrorString' in found_functions}}
0 commit comments