From 7828876305cce5b0c66513927ab85130d2138da2 Mon Sep 17 00:00:00 2001 From: Mike Droettboom Date: Thu, 4 Sep 2025 09:03:17 -0400 Subject: [PATCH 1/6] Fix #938: Call win32 APIs directly --- .../cuda/bindings/_bindings/cydriver.pyx.in | 3898 +++++------------ .../cuda/bindings/_bindings/cynvrtc.pyx.in | 173 +- .../bindings/_internal/nvjitlink_linux.pyx | 36 +- .../bindings/_internal/nvjitlink_windows.pyx | 145 +- .../cuda/bindings/_internal/nvvm_linux.pyx | 36 +- .../cuda/bindings/_internal/nvvm_windows.pyx | 140 +- cuda_bindings/cuda/bindings/_lib/windll.pxd | 36 + .../docs/source/release/13.X.Y-notes.rst | 1 + cuda_bindings/pyproject.toml | 1 - 9 files changed, 1377 insertions(+), 3089 deletions(-) create mode 100644 cuda_bindings/cuda/bindings/_lib/windll.pxd diff --git a/cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in index 909c18e7d0..6eba788805 100644 --- a/cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in +++ b/cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in @@ -4,12 +4,11 @@ # This code was automatically generated with version 13.0.0. Do not modify it directly. {{if 'Windows' == platform.system()}} import os -import win32api -from pywintypes import error +cimport cuda.bindings._lib.windll as windll {{else}} cimport cuda.bindings._lib.dlfcn as dlfcn {{endif}} -from libc.stdint cimport intptr_t +from libc.stdint cimport intptr_t, uintptr_t import os import sys cimport cuda.bindings._bindings.loader as loader @@ -513,24 +512,19 @@ cdef int _cuPythonInit() except -1 nogil: {{endif}} {{if 'Windows' == platform.system()}} - LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 - try: - handle = win32api.LoadLibraryEx(path, 0, LOAD_LIBRARY_SEARCH_SYSTEM32) - except error as e: + handle = windll.LoadLibraryExW(path, NULL, windll.LOAD_LIBRARY_SEARCH_SYSTEM32) + if handle == 0: raise RuntimeError('Failed to LoadLibraryEx ' + path) {{else}} handle = dlfcn.dlopen(bytes(path, encoding='utf-8'), dlfcn.RTLD_NOW) - if (handle == NULL): + if handle == NULL: raise RuntimeError('Failed to dlopen ' + path) {{endif}} # Get latest __cuGetProcAddress_v2 global __cuGetProcAddress_v2 {{if 'Windows' == platform.system()}} - try: - __cuGetProcAddress_v2 = win32api.GetProcAddress(handle, 'cuGetProcAddress_v2') - except: - pass + __cuGetProcAddress_v2 = windll.GetProcAddress(handle, 'cuGetProcAddress_v2') {{else}} __cuGetProcAddress_v2 = dlfcn.dlsym(handle, 'cuGetProcAddress_v2') {{endif}} @@ -2770,3886 +2764,2224 @@ cdef int _cuPythonInit() except -1 nogil: # Get all PTDS version of functions pass {{if 'cuMemcpy' in found_functions}} - try: - global __cuMemcpy - __cuMemcpy = win32api.GetProcAddress(handle, 'cuMemcpy_ptds') - except: - pass + global __cuMemcpy + __cuMemcpy = windll.GetProcAddress(handle, 'cuMemcpy_ptds') {{endif}} {{if 'cuMemcpyPeer' in found_functions}} - try: - global __cuMemcpyPeer - __cuMemcpyPeer = win32api.GetProcAddress(handle, 'cuMemcpyPeer_ptds') - except: - pass + global __cuMemcpyPeer + __cuMemcpyPeer = windll.GetProcAddress(handle, 'cuMemcpyPeer_ptds') {{endif}} {{if 'cuMemcpyHtoD_v2' in found_functions}} - try: - global __cuMemcpyHtoD_v2 - __cuMemcpyHtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoD_v2_ptds') - except: - pass + global __cuMemcpyHtoD_v2 + __cuMemcpyHtoD_v2 = windll.GetProcAddress(handle, 'cuMemcpyHtoD_v2_ptds') {{endif}} {{if 'cuMemcpyDtoH_v2' in found_functions}} - try: - global __cuMemcpyDtoH_v2 - __cuMemcpyDtoH_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoH_v2_ptds') - except: - pass + global __cuMemcpyDtoH_v2 + __cuMemcpyDtoH_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoH_v2_ptds') {{endif}} {{if 'cuMemcpyDtoD_v2' in found_functions}} - try: - global __cuMemcpyDtoD_v2 - __cuMemcpyDtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoD_v2_ptds') - except: - pass + global __cuMemcpyDtoD_v2 + __cuMemcpyDtoD_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoD_v2_ptds') {{endif}} {{if 'cuMemcpyDtoA_v2' in found_functions}} - try: - global __cuMemcpyDtoA_v2 - __cuMemcpyDtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoA_v2_ptds') - except: - pass + global __cuMemcpyDtoA_v2 + __cuMemcpyDtoA_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoA_v2_ptds') {{endif}} {{if 'cuMemcpyAtoD_v2' in found_functions}} - try: - global __cuMemcpyAtoD_v2 - __cuMemcpyAtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoD_v2_ptds') - except: - pass + global __cuMemcpyAtoD_v2 + __cuMemcpyAtoD_v2 = windll.GetProcAddress(handle, 'cuMemcpyAtoD_v2_ptds') {{endif}} {{if 'cuMemcpyHtoA_v2' in found_functions}} - try: - global __cuMemcpyHtoA_v2 - __cuMemcpyHtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoA_v2_ptds') - except: - pass + global __cuMemcpyHtoA_v2 + __cuMemcpyHtoA_v2 = windll.GetProcAddress(handle, 'cuMemcpyHtoA_v2_ptds') {{endif}} {{if 'cuMemcpyAtoH_v2' in found_functions}} - try: - global __cuMemcpyAtoH_v2 - __cuMemcpyAtoH_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoH_v2_ptds') - except: - pass + global __cuMemcpyAtoH_v2 + __cuMemcpyAtoH_v2 = windll.GetProcAddress(handle, 'cuMemcpyAtoH_v2_ptds') {{endif}} {{if 'cuMemcpyAtoA_v2' in found_functions}} - try: - global __cuMemcpyAtoA_v2 - __cuMemcpyAtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoA_v2_ptds') - except: - pass + global __cuMemcpyAtoA_v2 + __cuMemcpyAtoA_v2 = windll.GetProcAddress(handle, 'cuMemcpyAtoA_v2_ptds') {{endif}} {{if 'cuMemcpy2D_v2' in found_functions}} - try: - global __cuMemcpy2D_v2 - __cuMemcpy2D_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2D_v2_ptds') - except: - pass + global __cuMemcpy2D_v2 + __cuMemcpy2D_v2 = windll.GetProcAddress(handle, 'cuMemcpy2D_v2_ptds') {{endif}} {{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - try: - global __cuMemcpy2DUnaligned_v2 - __cuMemcpy2DUnaligned_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2DUnaligned_v2_ptds') - except: - pass + global __cuMemcpy2DUnaligned_v2 + __cuMemcpy2DUnaligned_v2 = windll.GetProcAddress(handle, 'cuMemcpy2DUnaligned_v2_ptds') {{endif}} {{if 'cuMemcpy3D_v2' in found_functions}} - try: - global __cuMemcpy3D_v2 - __cuMemcpy3D_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3D_v2_ptds') - except: - pass + global __cuMemcpy3D_v2 + __cuMemcpy3D_v2 = windll.GetProcAddress(handle, 'cuMemcpy3D_v2_ptds') {{endif}} {{if 'cuMemcpy3DPeer' in found_functions}} - try: - global __cuMemcpy3DPeer - __cuMemcpy3DPeer = win32api.GetProcAddress(handle, 'cuMemcpy3DPeer_ptds') - except: - pass + global __cuMemcpy3DPeer + __cuMemcpy3DPeer = windll.GetProcAddress(handle, 'cuMemcpy3DPeer_ptds') {{endif}} {{if 'cuMemcpyAsync' in found_functions}} - try: - global __cuMemcpyAsync - __cuMemcpyAsync = win32api.GetProcAddress(handle, 'cuMemcpyAsync_ptsz') - except: - pass + global __cuMemcpyAsync + __cuMemcpyAsync = windll.GetProcAddress(handle, 'cuMemcpyAsync_ptsz') {{endif}} {{if 'cuMemcpyPeerAsync' in found_functions}} - try: - global __cuMemcpyPeerAsync - __cuMemcpyPeerAsync = win32api.GetProcAddress(handle, 'cuMemcpyPeerAsync_ptsz') - except: - pass + global __cuMemcpyPeerAsync + __cuMemcpyPeerAsync = windll.GetProcAddress(handle, 'cuMemcpyPeerAsync_ptsz') {{endif}} {{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - try: - global __cuMemcpyHtoDAsync_v2 - __cuMemcpyHtoDAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoDAsync_v2_ptsz') - except: - pass + global __cuMemcpyHtoDAsync_v2 + __cuMemcpyHtoDAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyHtoDAsync_v2_ptsz') {{endif}} {{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - try: - global __cuMemcpyDtoHAsync_v2 - __cuMemcpyDtoHAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoHAsync_v2_ptsz') - except: - pass + global __cuMemcpyDtoHAsync_v2 + __cuMemcpyDtoHAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoHAsync_v2_ptsz') {{endif}} {{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - try: - global __cuMemcpyDtoDAsync_v2 - __cuMemcpyDtoDAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoDAsync_v2_ptsz') - except: - pass + global __cuMemcpyDtoDAsync_v2 + __cuMemcpyDtoDAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoDAsync_v2_ptsz') {{endif}} {{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - try: - global __cuMemcpyHtoAAsync_v2 - __cuMemcpyHtoAAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoAAsync_v2_ptsz') - except: - pass + global __cuMemcpyHtoAAsync_v2 + __cuMemcpyHtoAAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyHtoAAsync_v2_ptsz') {{endif}} {{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - try: - global __cuMemcpyAtoHAsync_v2 - __cuMemcpyAtoHAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoHAsync_v2_ptsz') - except: - pass + global __cuMemcpyAtoHAsync_v2 + __cuMemcpyAtoHAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyAtoHAsync_v2_ptsz') {{endif}} {{if 'cuMemcpy2DAsync_v2' in found_functions}} - try: - global __cuMemcpy2DAsync_v2 - __cuMemcpy2DAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2DAsync_v2_ptsz') - except: - pass + global __cuMemcpy2DAsync_v2 + __cuMemcpy2DAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpy2DAsync_v2_ptsz') {{endif}} {{if 'cuMemcpy3DAsync_v2' in found_functions}} - try: - global __cuMemcpy3DAsync_v2 - __cuMemcpy3DAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3DAsync_v2_ptsz') - except: - pass + global __cuMemcpy3DAsync_v2 + __cuMemcpy3DAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpy3DAsync_v2_ptsz') {{endif}} {{if 'cuMemcpy3DPeerAsync' in found_functions}} - try: - global __cuMemcpy3DPeerAsync - __cuMemcpy3DPeerAsync = win32api.GetProcAddress(handle, 'cuMemcpy3DPeerAsync_ptsz') - except: - pass + global __cuMemcpy3DPeerAsync + __cuMemcpy3DPeerAsync = windll.GetProcAddress(handle, 'cuMemcpy3DPeerAsync_ptsz') {{endif}} {{if 'cuMemcpyBatchAsync_v2' in found_functions}} - try: - global __cuMemcpyBatchAsync_v2 - __cuMemcpyBatchAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyBatchAsync_v2_ptsz') - except: - pass + global __cuMemcpyBatchAsync_v2 + __cuMemcpyBatchAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyBatchAsync_v2_ptsz') {{endif}} {{if 'cuMemcpy3DBatchAsync_v2' in found_functions}} - try: - global __cuMemcpy3DBatchAsync_v2 - __cuMemcpy3DBatchAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3DBatchAsync_v2_ptsz') - except: - pass + global __cuMemcpy3DBatchAsync_v2 + __cuMemcpy3DBatchAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpy3DBatchAsync_v2_ptsz') {{endif}} {{if 'cuMemsetD8_v2' in found_functions}} - try: - global __cuMemsetD8_v2 - __cuMemsetD8_v2 = win32api.GetProcAddress(handle, 'cuMemsetD8_v2_ptds') - except: - pass + global __cuMemsetD8_v2 + __cuMemsetD8_v2 = windll.GetProcAddress(handle, 'cuMemsetD8_v2_ptds') {{endif}} {{if 'cuMemsetD16_v2' in found_functions}} - try: - global __cuMemsetD16_v2 - __cuMemsetD16_v2 = win32api.GetProcAddress(handle, 'cuMemsetD16_v2_ptds') - except: - pass + global __cuMemsetD16_v2 + __cuMemsetD16_v2 = windll.GetProcAddress(handle, 'cuMemsetD16_v2_ptds') {{endif}} {{if 'cuMemsetD32_v2' in found_functions}} - try: - global __cuMemsetD32_v2 - __cuMemsetD32_v2 = win32api.GetProcAddress(handle, 'cuMemsetD32_v2_ptds') - except: - pass + global __cuMemsetD32_v2 + __cuMemsetD32_v2 = windll.GetProcAddress(handle, 'cuMemsetD32_v2_ptds') {{endif}} {{if 'cuMemsetD2D8_v2' in found_functions}} - try: - global __cuMemsetD2D8_v2 - __cuMemsetD2D8_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D8_v2_ptds') - except: - pass + global __cuMemsetD2D8_v2 + __cuMemsetD2D8_v2 = windll.GetProcAddress(handle, 'cuMemsetD2D8_v2_ptds') {{endif}} {{if 'cuMemsetD2D16_v2' in found_functions}} - try: - global __cuMemsetD2D16_v2 - __cuMemsetD2D16_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D16_v2_ptds') - except: - pass + global __cuMemsetD2D16_v2 + __cuMemsetD2D16_v2 = windll.GetProcAddress(handle, 'cuMemsetD2D16_v2_ptds') {{endif}} {{if 'cuMemsetD2D32_v2' in found_functions}} - try: - global __cuMemsetD2D32_v2 - __cuMemsetD2D32_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D32_v2_ptds') - except: - pass + global __cuMemsetD2D32_v2 + __cuMemsetD2D32_v2 = windll.GetProcAddress(handle, 'cuMemsetD2D32_v2_ptds') {{endif}} {{if 'cuMemsetD8Async' in found_functions}} - try: - global __cuMemsetD8Async - __cuMemsetD8Async = win32api.GetProcAddress(handle, 'cuMemsetD8Async_ptsz') - except: - pass + global __cuMemsetD8Async + __cuMemsetD8Async = windll.GetProcAddress(handle, 'cuMemsetD8Async_ptsz') {{endif}} {{if 'cuMemsetD16Async' in found_functions}} - try: - global __cuMemsetD16Async - __cuMemsetD16Async = win32api.GetProcAddress(handle, 'cuMemsetD16Async_ptsz') - except: - pass + global __cuMemsetD16Async + __cuMemsetD16Async = windll.GetProcAddress(handle, 'cuMemsetD16Async_ptsz') {{endif}} {{if 'cuMemsetD32Async' in found_functions}} - try: - global __cuMemsetD32Async - __cuMemsetD32Async = win32api.GetProcAddress(handle, 'cuMemsetD32Async_ptsz') - except: - pass + global __cuMemsetD32Async + __cuMemsetD32Async = windll.GetProcAddress(handle, 'cuMemsetD32Async_ptsz') {{endif}} {{if 'cuMemsetD2D8Async' in found_functions}} - try: - global __cuMemsetD2D8Async - __cuMemsetD2D8Async = win32api.GetProcAddress(handle, 'cuMemsetD2D8Async_ptsz') - except: - pass + global __cuMemsetD2D8Async + __cuMemsetD2D8Async = windll.GetProcAddress(handle, 'cuMemsetD2D8Async_ptsz') {{endif}} {{if 'cuMemsetD2D16Async' in found_functions}} - try: - global __cuMemsetD2D16Async - __cuMemsetD2D16Async = win32api.GetProcAddress(handle, 'cuMemsetD2D16Async_ptsz') - except: - pass + global __cuMemsetD2D16Async + __cuMemsetD2D16Async = windll.GetProcAddress(handle, 'cuMemsetD2D16Async_ptsz') {{endif}} {{if 'cuMemsetD2D32Async' in found_functions}} - try: - global __cuMemsetD2D32Async - __cuMemsetD2D32Async = win32api.GetProcAddress(handle, 'cuMemsetD2D32Async_ptsz') - except: - pass + global __cuMemsetD2D32Async + __cuMemsetD2D32Async = windll.GetProcAddress(handle, 'cuMemsetD2D32Async_ptsz') {{endif}} {{if 'cuMemBatchDecompressAsync' in found_functions}} - try: - global __cuMemBatchDecompressAsync - __cuMemBatchDecompressAsync = win32api.GetProcAddress(handle, 'cuMemBatchDecompressAsync_ptsz') - except: - pass + global __cuMemBatchDecompressAsync + __cuMemBatchDecompressAsync = windll.GetProcAddress(handle, 'cuMemBatchDecompressAsync_ptsz') {{endif}} {{if 'cuMemMapArrayAsync' in found_functions}} - try: - global __cuMemMapArrayAsync - __cuMemMapArrayAsync = win32api.GetProcAddress(handle, 'cuMemMapArrayAsync_ptsz') - except: - pass + global __cuMemMapArrayAsync + __cuMemMapArrayAsync = windll.GetProcAddress(handle, 'cuMemMapArrayAsync_ptsz') {{endif}} {{if 'cuMemFreeAsync' in found_functions}} - try: - global __cuMemFreeAsync - __cuMemFreeAsync = win32api.GetProcAddress(handle, 'cuMemFreeAsync_ptsz') - except: - pass + global __cuMemFreeAsync + __cuMemFreeAsync = windll.GetProcAddress(handle, 'cuMemFreeAsync_ptsz') {{endif}} {{if 'cuMemAllocAsync' in found_functions}} - try: - global __cuMemAllocAsync - __cuMemAllocAsync = win32api.GetProcAddress(handle, 'cuMemAllocAsync_ptsz') - except: - pass + global __cuMemAllocAsync + __cuMemAllocAsync = windll.GetProcAddress(handle, 'cuMemAllocAsync_ptsz') {{endif}} {{if 'cuMemAllocFromPoolAsync' in found_functions}} - try: - global __cuMemAllocFromPoolAsync - __cuMemAllocFromPoolAsync = win32api.GetProcAddress(handle, 'cuMemAllocFromPoolAsync_ptsz') - except: - pass + global __cuMemAllocFromPoolAsync + __cuMemAllocFromPoolAsync = windll.GetProcAddress(handle, 'cuMemAllocFromPoolAsync_ptsz') {{endif}} {{if 'cuMemPrefetchAsync_v2' in found_functions}} - try: - global __cuMemPrefetchAsync_v2 - __cuMemPrefetchAsync_v2 = win32api.GetProcAddress(handle, 'cuMemPrefetchAsync_v2_ptsz') - except: - pass + global __cuMemPrefetchAsync_v2 + __cuMemPrefetchAsync_v2 = windll.GetProcAddress(handle, 'cuMemPrefetchAsync_v2_ptsz') {{endif}} {{if 'cuMemPrefetchBatchAsync' in found_functions}} - try: - global __cuMemPrefetchBatchAsync - __cuMemPrefetchBatchAsync = win32api.GetProcAddress(handle, 'cuMemPrefetchBatchAsync_ptsz') - except: - pass + global __cuMemPrefetchBatchAsync + __cuMemPrefetchBatchAsync = windll.GetProcAddress(handle, 'cuMemPrefetchBatchAsync_ptsz') {{endif}} {{if 'cuMemDiscardBatchAsync' in found_functions}} - try: - global __cuMemDiscardBatchAsync - __cuMemDiscardBatchAsync = win32api.GetProcAddress(handle, 'cuMemDiscardBatchAsync_ptsz') - except: - pass + global __cuMemDiscardBatchAsync + __cuMemDiscardBatchAsync = windll.GetProcAddress(handle, 'cuMemDiscardBatchAsync_ptsz') {{endif}} {{if 'cuMemDiscardAndPrefetchBatchAsync' in found_functions}} - try: - global __cuMemDiscardAndPrefetchBatchAsync - __cuMemDiscardAndPrefetchBatchAsync = win32api.GetProcAddress(handle, 'cuMemDiscardAndPrefetchBatchAsync_ptsz') - except: - pass + global __cuMemDiscardAndPrefetchBatchAsync + __cuMemDiscardAndPrefetchBatchAsync = windll.GetProcAddress(handle, 'cuMemDiscardAndPrefetchBatchAsync_ptsz') {{endif}} {{if 'cuStreamGetPriority' in found_functions}} - try: - global __cuStreamGetPriority - __cuStreamGetPriority = win32api.GetProcAddress(handle, 'cuStreamGetPriority_ptsz') - except: - pass + global __cuStreamGetPriority + __cuStreamGetPriority = windll.GetProcAddress(handle, 'cuStreamGetPriority_ptsz') {{endif}} {{if 'cuStreamGetDevice' in found_functions}} - try: - global __cuStreamGetDevice - __cuStreamGetDevice = win32api.GetProcAddress(handle, 'cuStreamGetDevice_ptsz') - except: - pass + global __cuStreamGetDevice + __cuStreamGetDevice = windll.GetProcAddress(handle, 'cuStreamGetDevice_ptsz') {{endif}} {{if 'cuStreamGetFlags' in found_functions}} - try: - global __cuStreamGetFlags - __cuStreamGetFlags = win32api.GetProcAddress(handle, 'cuStreamGetFlags_ptsz') - except: - pass + global __cuStreamGetFlags + __cuStreamGetFlags = windll.GetProcAddress(handle, 'cuStreamGetFlags_ptsz') {{endif}} {{if 'cuStreamGetId' in found_functions}} - try: - global __cuStreamGetId - __cuStreamGetId = win32api.GetProcAddress(handle, 'cuStreamGetId_ptsz') - except: - pass + global __cuStreamGetId + __cuStreamGetId = windll.GetProcAddress(handle, 'cuStreamGetId_ptsz') {{endif}} {{if 'cuStreamGetCtx' in found_functions}} - try: - global __cuStreamGetCtx - __cuStreamGetCtx = win32api.GetProcAddress(handle, 'cuStreamGetCtx_ptsz') - except: - pass + global __cuStreamGetCtx + __cuStreamGetCtx = windll.GetProcAddress(handle, 'cuStreamGetCtx_ptsz') {{endif}} {{if 'cuStreamGetCtx_v2' in found_functions}} - try: - global __cuStreamGetCtx_v2 - __cuStreamGetCtx_v2 = win32api.GetProcAddress(handle, 'cuStreamGetCtx_v2_ptsz') - except: - pass + global __cuStreamGetCtx_v2 + __cuStreamGetCtx_v2 = windll.GetProcAddress(handle, 'cuStreamGetCtx_v2_ptsz') {{endif}} {{if 'cuStreamWaitEvent' in found_functions}} - try: - global __cuStreamWaitEvent - __cuStreamWaitEvent = win32api.GetProcAddress(handle, 'cuStreamWaitEvent_ptsz') - except: - pass + global __cuStreamWaitEvent + __cuStreamWaitEvent = windll.GetProcAddress(handle, 'cuStreamWaitEvent_ptsz') {{endif}} {{if 'cuStreamAddCallback' in found_functions}} - try: - global __cuStreamAddCallback - __cuStreamAddCallback = win32api.GetProcAddress(handle, 'cuStreamAddCallback_ptsz') - except: - pass + global __cuStreamAddCallback + __cuStreamAddCallback = windll.GetProcAddress(handle, 'cuStreamAddCallback_ptsz') {{endif}} {{if 'cuStreamBeginCapture_v2' in found_functions}} - try: - global __cuStreamBeginCapture_v2 - __cuStreamBeginCapture_v2 = win32api.GetProcAddress(handle, 'cuStreamBeginCapture_v2_ptsz') - except: - pass + global __cuStreamBeginCapture_v2 + __cuStreamBeginCapture_v2 = windll.GetProcAddress(handle, 'cuStreamBeginCapture_v2_ptsz') {{endif}} {{if 'cuStreamBeginCaptureToGraph' in found_functions}} - try: - global __cuStreamBeginCaptureToGraph - __cuStreamBeginCaptureToGraph = win32api.GetProcAddress(handle, 'cuStreamBeginCaptureToGraph_ptsz') - except: - pass + global __cuStreamBeginCaptureToGraph + __cuStreamBeginCaptureToGraph = windll.GetProcAddress(handle, 'cuStreamBeginCaptureToGraph_ptsz') {{endif}} {{if 'cuStreamEndCapture' in found_functions}} - try: - global __cuStreamEndCapture - __cuStreamEndCapture = win32api.GetProcAddress(handle, 'cuStreamEndCapture_ptsz') - except: - pass + global __cuStreamEndCapture + __cuStreamEndCapture = windll.GetProcAddress(handle, 'cuStreamEndCapture_ptsz') {{endif}} {{if 'cuStreamIsCapturing' in found_functions}} - try: - global __cuStreamIsCapturing - __cuStreamIsCapturing = win32api.GetProcAddress(handle, 'cuStreamIsCapturing_ptsz') - except: - pass + global __cuStreamIsCapturing + __cuStreamIsCapturing = windll.GetProcAddress(handle, 'cuStreamIsCapturing_ptsz') {{endif}} {{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - try: - global __cuStreamGetCaptureInfo_v3 - __cuStreamGetCaptureInfo_v3 = win32api.GetProcAddress(handle, 'cuStreamGetCaptureInfo_v3_ptsz') - except: - pass + global __cuStreamGetCaptureInfo_v3 + __cuStreamGetCaptureInfo_v3 = windll.GetProcAddress(handle, 'cuStreamGetCaptureInfo_v3_ptsz') {{endif}} {{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - try: - global __cuStreamUpdateCaptureDependencies_v2 - __cuStreamUpdateCaptureDependencies_v2 = win32api.GetProcAddress(handle, 'cuStreamUpdateCaptureDependencies_v2_ptsz') - except: - pass + global __cuStreamUpdateCaptureDependencies_v2 + __cuStreamUpdateCaptureDependencies_v2 = windll.GetProcAddress(handle, 'cuStreamUpdateCaptureDependencies_v2_ptsz') {{endif}} {{if 'cuStreamAttachMemAsync' in found_functions}} - try: - global __cuStreamAttachMemAsync - __cuStreamAttachMemAsync = win32api.GetProcAddress(handle, 'cuStreamAttachMemAsync_ptsz') - except: - pass + global __cuStreamAttachMemAsync + __cuStreamAttachMemAsync = windll.GetProcAddress(handle, 'cuStreamAttachMemAsync_ptsz') {{endif}} {{if 'cuStreamQuery' in found_functions}} - try: - global __cuStreamQuery - __cuStreamQuery = win32api.GetProcAddress(handle, 'cuStreamQuery_ptsz') - except: - pass + global __cuStreamQuery + __cuStreamQuery = windll.GetProcAddress(handle, 'cuStreamQuery_ptsz') {{endif}} {{if 'cuStreamSynchronize' in found_functions}} - try: - global __cuStreamSynchronize - __cuStreamSynchronize = win32api.GetProcAddress(handle, 'cuStreamSynchronize_ptsz') - except: - pass + global __cuStreamSynchronize + __cuStreamSynchronize = windll.GetProcAddress(handle, 'cuStreamSynchronize_ptsz') {{endif}} {{if 'cuStreamCopyAttributes' in found_functions}} - try: - global __cuStreamCopyAttributes - __cuStreamCopyAttributes = win32api.GetProcAddress(handle, 'cuStreamCopyAttributes_ptsz') - except: - pass + global __cuStreamCopyAttributes + __cuStreamCopyAttributes = windll.GetProcAddress(handle, 'cuStreamCopyAttributes_ptsz') {{endif}} {{if 'cuStreamGetAttribute' in found_functions}} - try: - global __cuStreamGetAttribute - __cuStreamGetAttribute = win32api.GetProcAddress(handle, 'cuStreamGetAttribute_ptsz') - except: - pass + global __cuStreamGetAttribute + __cuStreamGetAttribute = windll.GetProcAddress(handle, 'cuStreamGetAttribute_ptsz') {{endif}} {{if 'cuStreamSetAttribute' in found_functions}} - try: - global __cuStreamSetAttribute - __cuStreamSetAttribute = win32api.GetProcAddress(handle, 'cuStreamSetAttribute_ptsz') - except: - pass + global __cuStreamSetAttribute + __cuStreamSetAttribute = windll.GetProcAddress(handle, 'cuStreamSetAttribute_ptsz') {{endif}} {{if 'cuEventRecord' in found_functions}} - try: - global __cuEventRecord - __cuEventRecord = win32api.GetProcAddress(handle, 'cuEventRecord_ptsz') - except: - pass + global __cuEventRecord + __cuEventRecord = windll.GetProcAddress(handle, 'cuEventRecord_ptsz') {{endif}} {{if 'cuEventRecordWithFlags' in found_functions}} - try: - global __cuEventRecordWithFlags - __cuEventRecordWithFlags = win32api.GetProcAddress(handle, 'cuEventRecordWithFlags_ptsz') - except: - pass + global __cuEventRecordWithFlags + __cuEventRecordWithFlags = windll.GetProcAddress(handle, 'cuEventRecordWithFlags_ptsz') {{endif}} {{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - try: - global __cuSignalExternalSemaphoresAsync - __cuSignalExternalSemaphoresAsync = win32api.GetProcAddress(handle, 'cuSignalExternalSemaphoresAsync_ptsz') - except: - pass + global __cuSignalExternalSemaphoresAsync + __cuSignalExternalSemaphoresAsync = windll.GetProcAddress(handle, 'cuSignalExternalSemaphoresAsync_ptsz') {{endif}} {{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - try: - global __cuWaitExternalSemaphoresAsync - __cuWaitExternalSemaphoresAsync = win32api.GetProcAddress(handle, 'cuWaitExternalSemaphoresAsync_ptsz') - except: - pass + global __cuWaitExternalSemaphoresAsync + __cuWaitExternalSemaphoresAsync = windll.GetProcAddress(handle, 'cuWaitExternalSemaphoresAsync_ptsz') {{endif}} {{if 'cuStreamWaitValue32_v2' in found_functions}} - try: - global __cuStreamWaitValue32_v2 - __cuStreamWaitValue32_v2 = win32api.GetProcAddress(handle, 'cuStreamWaitValue32_v2_ptsz') - except: - pass + global __cuStreamWaitValue32_v2 + __cuStreamWaitValue32_v2 = windll.GetProcAddress(handle, 'cuStreamWaitValue32_v2_ptsz') {{endif}} {{if 'cuStreamWaitValue64_v2' in found_functions}} - try: - global __cuStreamWaitValue64_v2 - __cuStreamWaitValue64_v2 = win32api.GetProcAddress(handle, 'cuStreamWaitValue64_v2_ptsz') - except: - pass + global __cuStreamWaitValue64_v2 + __cuStreamWaitValue64_v2 = windll.GetProcAddress(handle, 'cuStreamWaitValue64_v2_ptsz') {{endif}} {{if 'cuStreamWriteValue32_v2' in found_functions}} - try: - global __cuStreamWriteValue32_v2 - __cuStreamWriteValue32_v2 = win32api.GetProcAddress(handle, 'cuStreamWriteValue32_v2_ptsz') - except: - pass + global __cuStreamWriteValue32_v2 + __cuStreamWriteValue32_v2 = windll.GetProcAddress(handle, 'cuStreamWriteValue32_v2_ptsz') {{endif}} {{if 'cuStreamWriteValue64_v2' in found_functions}} - try: - global __cuStreamWriteValue64_v2 - __cuStreamWriteValue64_v2 = win32api.GetProcAddress(handle, 'cuStreamWriteValue64_v2_ptsz') - except: - pass + global __cuStreamWriteValue64_v2 + __cuStreamWriteValue64_v2 = windll.GetProcAddress(handle, 'cuStreamWriteValue64_v2_ptsz') {{endif}} {{if 'cuStreamBatchMemOp_v2' in found_functions}} - try: - global __cuStreamBatchMemOp_v2 - __cuStreamBatchMemOp_v2 = win32api.GetProcAddress(handle, 'cuStreamBatchMemOp_v2_ptsz') - except: - pass + global __cuStreamBatchMemOp_v2 + __cuStreamBatchMemOp_v2 = windll.GetProcAddress(handle, 'cuStreamBatchMemOp_v2_ptsz') {{endif}} {{if 'cuLaunchKernel' in found_functions}} - try: - global __cuLaunchKernel - __cuLaunchKernel = win32api.GetProcAddress(handle, 'cuLaunchKernel_ptsz') - except: - pass + global __cuLaunchKernel + __cuLaunchKernel = windll.GetProcAddress(handle, 'cuLaunchKernel_ptsz') {{endif}} {{if 'cuLaunchKernelEx' in found_functions}} - try: - global __cuLaunchKernelEx - __cuLaunchKernelEx = win32api.GetProcAddress(handle, 'cuLaunchKernelEx_ptsz') - except: - pass + global __cuLaunchKernelEx + __cuLaunchKernelEx = windll.GetProcAddress(handle, 'cuLaunchKernelEx_ptsz') {{endif}} {{if 'cuLaunchCooperativeKernel' in found_functions}} - try: - global __cuLaunchCooperativeKernel - __cuLaunchCooperativeKernel = win32api.GetProcAddress(handle, 'cuLaunchCooperativeKernel_ptsz') - except: - pass + global __cuLaunchCooperativeKernel + __cuLaunchCooperativeKernel = windll.GetProcAddress(handle, 'cuLaunchCooperativeKernel_ptsz') {{endif}} {{if 'cuLaunchHostFunc' in found_functions}} - try: - global __cuLaunchHostFunc - __cuLaunchHostFunc = win32api.GetProcAddress(handle, 'cuLaunchHostFunc_ptsz') - except: - pass + global __cuLaunchHostFunc + __cuLaunchHostFunc = windll.GetProcAddress(handle, 'cuLaunchHostFunc_ptsz') {{endif}} {{if 'cuGraphInstantiateWithParams' in found_functions}} - try: - global __cuGraphInstantiateWithParams - __cuGraphInstantiateWithParams = win32api.GetProcAddress(handle, 'cuGraphInstantiateWithParams_ptsz') - except: - pass + global __cuGraphInstantiateWithParams + __cuGraphInstantiateWithParams = windll.GetProcAddress(handle, 'cuGraphInstantiateWithParams_ptsz') {{endif}} {{if 'cuGraphUpload' in found_functions}} - try: - global __cuGraphUpload - __cuGraphUpload = win32api.GetProcAddress(handle, 'cuGraphUpload_ptsz') - except: - pass + global __cuGraphUpload + __cuGraphUpload = windll.GetProcAddress(handle, 'cuGraphUpload_ptsz') {{endif}} {{if 'cuGraphLaunch' in found_functions}} - try: - global __cuGraphLaunch - __cuGraphLaunch = win32api.GetProcAddress(handle, 'cuGraphLaunch_ptsz') - except: - pass + global __cuGraphLaunch + __cuGraphLaunch = windll.GetProcAddress(handle, 'cuGraphLaunch_ptsz') {{endif}} {{if 'cuGraphicsMapResources' in found_functions}} - try: - global __cuGraphicsMapResources - __cuGraphicsMapResources = win32api.GetProcAddress(handle, 'cuGraphicsMapResources_ptsz') - except: - pass + global __cuGraphicsMapResources + __cuGraphicsMapResources = windll.GetProcAddress(handle, 'cuGraphicsMapResources_ptsz') {{endif}} {{if 'cuGraphicsUnmapResources' in found_functions}} - try: - global __cuGraphicsUnmapResources - __cuGraphicsUnmapResources = win32api.GetProcAddress(handle, 'cuGraphicsUnmapResources_ptsz') - except: - pass + global __cuGraphicsUnmapResources + __cuGraphicsUnmapResources = windll.GetProcAddress(handle, 'cuGraphicsUnmapResources_ptsz') {{endif}} else: # Else get the regular version pass {{if 'cuMemcpy' in found_functions}} - try: - global __cuMemcpy - __cuMemcpy = win32api.GetProcAddress(handle, 'cuMemcpy') - except: - pass + global __cuMemcpy + __cuMemcpy = windll.GetProcAddress(handle, 'cuMemcpy') {{endif}} {{if 'cuMemcpyPeer' in found_functions}} - try: - global __cuMemcpyPeer - __cuMemcpyPeer = win32api.GetProcAddress(handle, 'cuMemcpyPeer') - except: - pass + global __cuMemcpyPeer + __cuMemcpyPeer = windll.GetProcAddress(handle, 'cuMemcpyPeer') {{endif}} {{if 'cuMemcpyHtoD_v2' in found_functions}} - try: - global __cuMemcpyHtoD_v2 - __cuMemcpyHtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoD_v2') - except: - pass + global __cuMemcpyHtoD_v2 + __cuMemcpyHtoD_v2 = windll.GetProcAddress(handle, 'cuMemcpyHtoD_v2') {{endif}} {{if 'cuMemcpyDtoH_v2' in found_functions}} - try: - global __cuMemcpyDtoH_v2 - __cuMemcpyDtoH_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoH_v2') - except: - pass + global __cuMemcpyDtoH_v2 + __cuMemcpyDtoH_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoH_v2') {{endif}} {{if 'cuMemcpyDtoD_v2' in found_functions}} - try: - global __cuMemcpyDtoD_v2 - __cuMemcpyDtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoD_v2') - except: - pass + global __cuMemcpyDtoD_v2 + __cuMemcpyDtoD_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoD_v2') {{endif}} {{if 'cuMemcpyDtoA_v2' in found_functions}} - try: - global __cuMemcpyDtoA_v2 - __cuMemcpyDtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoA_v2') - except: - pass + global __cuMemcpyDtoA_v2 + __cuMemcpyDtoA_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoA_v2') {{endif}} {{if 'cuMemcpyAtoD_v2' in found_functions}} - try: - global __cuMemcpyAtoD_v2 - __cuMemcpyAtoD_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoD_v2') - except: - pass + global __cuMemcpyAtoD_v2 + __cuMemcpyAtoD_v2 = windll.GetProcAddress(handle, 'cuMemcpyAtoD_v2') {{endif}} {{if 'cuMemcpyHtoA_v2' in found_functions}} - try: - global __cuMemcpyHtoA_v2 - __cuMemcpyHtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoA_v2') - except: - pass + global __cuMemcpyHtoA_v2 + __cuMemcpyHtoA_v2 = windll.GetProcAddress(handle, 'cuMemcpyHtoA_v2') {{endif}} {{if 'cuMemcpyAtoH_v2' in found_functions}} - try: - global __cuMemcpyAtoH_v2 - __cuMemcpyAtoH_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoH_v2') - except: - pass + global __cuMemcpyAtoH_v2 + __cuMemcpyAtoH_v2 = windll.GetProcAddress(handle, 'cuMemcpyAtoH_v2') {{endif}} {{if 'cuMemcpyAtoA_v2' in found_functions}} - try: - global __cuMemcpyAtoA_v2 - __cuMemcpyAtoA_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoA_v2') - except: - pass + global __cuMemcpyAtoA_v2 + __cuMemcpyAtoA_v2 = windll.GetProcAddress(handle, 'cuMemcpyAtoA_v2') {{endif}} {{if 'cuMemcpy2D_v2' in found_functions}} - try: - global __cuMemcpy2D_v2 - __cuMemcpy2D_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2D_v2') - except: - pass + global __cuMemcpy2D_v2 + __cuMemcpy2D_v2 = windll.GetProcAddress(handle, 'cuMemcpy2D_v2') {{endif}} {{if 'cuMemcpy2DUnaligned_v2' in found_functions}} - try: - global __cuMemcpy2DUnaligned_v2 - __cuMemcpy2DUnaligned_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2DUnaligned_v2') - except: - pass + global __cuMemcpy2DUnaligned_v2 + __cuMemcpy2DUnaligned_v2 = windll.GetProcAddress(handle, 'cuMemcpy2DUnaligned_v2') {{endif}} {{if 'cuMemcpy3D_v2' in found_functions}} - try: - global __cuMemcpy3D_v2 - __cuMemcpy3D_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3D_v2') - except: - pass + global __cuMemcpy3D_v2 + __cuMemcpy3D_v2 = windll.GetProcAddress(handle, 'cuMemcpy3D_v2') {{endif}} {{if 'cuMemcpy3DPeer' in found_functions}} - try: - global __cuMemcpy3DPeer - __cuMemcpy3DPeer = win32api.GetProcAddress(handle, 'cuMemcpy3DPeer') - except: - pass + global __cuMemcpy3DPeer + __cuMemcpy3DPeer = windll.GetProcAddress(handle, 'cuMemcpy3DPeer') {{endif}} {{if 'cuMemcpyAsync' in found_functions}} - try: - global __cuMemcpyAsync - __cuMemcpyAsync = win32api.GetProcAddress(handle, 'cuMemcpyAsync') - except: - pass + global __cuMemcpyAsync + __cuMemcpyAsync = windll.GetProcAddress(handle, 'cuMemcpyAsync') {{endif}} {{if 'cuMemcpyPeerAsync' in found_functions}} - try: - global __cuMemcpyPeerAsync - __cuMemcpyPeerAsync = win32api.GetProcAddress(handle, 'cuMemcpyPeerAsync') - except: - pass + global __cuMemcpyPeerAsync + __cuMemcpyPeerAsync = windll.GetProcAddress(handle, 'cuMemcpyPeerAsync') {{endif}} {{if 'cuMemcpyHtoDAsync_v2' in found_functions}} - try: - global __cuMemcpyHtoDAsync_v2 - __cuMemcpyHtoDAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoDAsync_v2') - except: - pass + global __cuMemcpyHtoDAsync_v2 + __cuMemcpyHtoDAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyHtoDAsync_v2') {{endif}} {{if 'cuMemcpyDtoHAsync_v2' in found_functions}} - try: - global __cuMemcpyDtoHAsync_v2 - __cuMemcpyDtoHAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoHAsync_v2') - except: - pass + global __cuMemcpyDtoHAsync_v2 + __cuMemcpyDtoHAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoHAsync_v2') {{endif}} {{if 'cuMemcpyDtoDAsync_v2' in found_functions}} - try: - global __cuMemcpyDtoDAsync_v2 - __cuMemcpyDtoDAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyDtoDAsync_v2') - except: - pass + global __cuMemcpyDtoDAsync_v2 + __cuMemcpyDtoDAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyDtoDAsync_v2') {{endif}} {{if 'cuMemcpyHtoAAsync_v2' in found_functions}} - try: - global __cuMemcpyHtoAAsync_v2 - __cuMemcpyHtoAAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyHtoAAsync_v2') - except: - pass + global __cuMemcpyHtoAAsync_v2 + __cuMemcpyHtoAAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyHtoAAsync_v2') {{endif}} {{if 'cuMemcpyAtoHAsync_v2' in found_functions}} - try: - global __cuMemcpyAtoHAsync_v2 - __cuMemcpyAtoHAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyAtoHAsync_v2') - except: - pass + global __cuMemcpyAtoHAsync_v2 + __cuMemcpyAtoHAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyAtoHAsync_v2') {{endif}} {{if 'cuMemcpy2DAsync_v2' in found_functions}} - try: - global __cuMemcpy2DAsync_v2 - __cuMemcpy2DAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy2DAsync_v2') - except: - pass + global __cuMemcpy2DAsync_v2 + __cuMemcpy2DAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpy2DAsync_v2') {{endif}} {{if 'cuMemcpy3DAsync_v2' in found_functions}} - try: - global __cuMemcpy3DAsync_v2 - __cuMemcpy3DAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3DAsync_v2') - except: - pass + global __cuMemcpy3DAsync_v2 + __cuMemcpy3DAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpy3DAsync_v2') {{endif}} {{if 'cuMemcpy3DPeerAsync' in found_functions}} - try: - global __cuMemcpy3DPeerAsync - __cuMemcpy3DPeerAsync = win32api.GetProcAddress(handle, 'cuMemcpy3DPeerAsync') - except: - pass + global __cuMemcpy3DPeerAsync + __cuMemcpy3DPeerAsync = windll.GetProcAddress(handle, 'cuMemcpy3DPeerAsync') {{endif}} {{if 'cuMemcpyBatchAsync_v2' in found_functions}} - try: - global __cuMemcpyBatchAsync_v2 - __cuMemcpyBatchAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpyBatchAsync_v2') - except: - pass + global __cuMemcpyBatchAsync_v2 + __cuMemcpyBatchAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpyBatchAsync_v2') {{endif}} {{if 'cuMemcpy3DBatchAsync_v2' in found_functions}} - try: - global __cuMemcpy3DBatchAsync_v2 - __cuMemcpy3DBatchAsync_v2 = win32api.GetProcAddress(handle, 'cuMemcpy3DBatchAsync_v2') - except: - pass + global __cuMemcpy3DBatchAsync_v2 + __cuMemcpy3DBatchAsync_v2 = windll.GetProcAddress(handle, 'cuMemcpy3DBatchAsync_v2') {{endif}} {{if 'cuMemsetD8_v2' in found_functions}} - try: - global __cuMemsetD8_v2 - __cuMemsetD8_v2 = win32api.GetProcAddress(handle, 'cuMemsetD8_v2') - except: - pass + global __cuMemsetD8_v2 + __cuMemsetD8_v2 = windll.GetProcAddress(handle, 'cuMemsetD8_v2') {{endif}} {{if 'cuMemsetD16_v2' in found_functions}} - try: - global __cuMemsetD16_v2 - __cuMemsetD16_v2 = win32api.GetProcAddress(handle, 'cuMemsetD16_v2') - except: - pass + global __cuMemsetD16_v2 + __cuMemsetD16_v2 = windll.GetProcAddress(handle, 'cuMemsetD16_v2') {{endif}} {{if 'cuMemsetD32_v2' in found_functions}} - try: - global __cuMemsetD32_v2 - __cuMemsetD32_v2 = win32api.GetProcAddress(handle, 'cuMemsetD32_v2') - except: - pass + global __cuMemsetD32_v2 + __cuMemsetD32_v2 = windll.GetProcAddress(handle, 'cuMemsetD32_v2') {{endif}} {{if 'cuMemsetD2D8_v2' in found_functions}} - try: - global __cuMemsetD2D8_v2 - __cuMemsetD2D8_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D8_v2') - except: - pass + global __cuMemsetD2D8_v2 + __cuMemsetD2D8_v2 = windll.GetProcAddress(handle, 'cuMemsetD2D8_v2') {{endif}} {{if 'cuMemsetD2D16_v2' in found_functions}} - try: - global __cuMemsetD2D16_v2 - __cuMemsetD2D16_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D16_v2') - except: - pass + global __cuMemsetD2D16_v2 + __cuMemsetD2D16_v2 = windll.GetProcAddress(handle, 'cuMemsetD2D16_v2') {{endif}} {{if 'cuMemsetD2D32_v2' in found_functions}} - try: - global __cuMemsetD2D32_v2 - __cuMemsetD2D32_v2 = win32api.GetProcAddress(handle, 'cuMemsetD2D32_v2') - except: - pass + global __cuMemsetD2D32_v2 + __cuMemsetD2D32_v2 = windll.GetProcAddress(handle, 'cuMemsetD2D32_v2') {{endif}} {{if 'cuMemsetD8Async' in found_functions}} - try: - global __cuMemsetD8Async - __cuMemsetD8Async = win32api.GetProcAddress(handle, 'cuMemsetD8Async') - except: - pass + global __cuMemsetD8Async + __cuMemsetD8Async = windll.GetProcAddress(handle, 'cuMemsetD8Async') {{endif}} {{if 'cuMemsetD16Async' in found_functions}} - try: - global __cuMemsetD16Async - __cuMemsetD16Async = win32api.GetProcAddress(handle, 'cuMemsetD16Async') - except: - pass + global __cuMemsetD16Async + __cuMemsetD16Async = windll.GetProcAddress(handle, 'cuMemsetD16Async') {{endif}} {{if 'cuMemsetD32Async' in found_functions}} - try: - global __cuMemsetD32Async - __cuMemsetD32Async = win32api.GetProcAddress(handle, 'cuMemsetD32Async') - except: - pass + global __cuMemsetD32Async + __cuMemsetD32Async = windll.GetProcAddress(handle, 'cuMemsetD32Async') {{endif}} {{if 'cuMemsetD2D8Async' in found_functions}} - try: - global __cuMemsetD2D8Async - __cuMemsetD2D8Async = win32api.GetProcAddress(handle, 'cuMemsetD2D8Async') - except: - pass + global __cuMemsetD2D8Async + __cuMemsetD2D8Async = windll.GetProcAddress(handle, 'cuMemsetD2D8Async') {{endif}} {{if 'cuMemsetD2D16Async' in found_functions}} - try: - global __cuMemsetD2D16Async - __cuMemsetD2D16Async = win32api.GetProcAddress(handle, 'cuMemsetD2D16Async') - except: - pass + global __cuMemsetD2D16Async + __cuMemsetD2D16Async = windll.GetProcAddress(handle, 'cuMemsetD2D16Async') {{endif}} {{if 'cuMemsetD2D32Async' in found_functions}} - try: - global __cuMemsetD2D32Async - __cuMemsetD2D32Async = win32api.GetProcAddress(handle, 'cuMemsetD2D32Async') - except: - pass + global __cuMemsetD2D32Async + __cuMemsetD2D32Async = windll.GetProcAddress(handle, 'cuMemsetD2D32Async') {{endif}} {{if 'cuMemBatchDecompressAsync' in found_functions}} - try: - global __cuMemBatchDecompressAsync - __cuMemBatchDecompressAsync = win32api.GetProcAddress(handle, 'cuMemBatchDecompressAsync') - except: - pass + global __cuMemBatchDecompressAsync + __cuMemBatchDecompressAsync = windll.GetProcAddress(handle, 'cuMemBatchDecompressAsync') {{endif}} {{if 'cuMemMapArrayAsync' in found_functions}} - try: - global __cuMemMapArrayAsync - __cuMemMapArrayAsync = win32api.GetProcAddress(handle, 'cuMemMapArrayAsync') - except: - pass + global __cuMemMapArrayAsync + __cuMemMapArrayAsync = windll.GetProcAddress(handle, 'cuMemMapArrayAsync') {{endif}} {{if 'cuMemFreeAsync' in found_functions}} - try: - global __cuMemFreeAsync - __cuMemFreeAsync = win32api.GetProcAddress(handle, 'cuMemFreeAsync') - except: - pass + global __cuMemFreeAsync + __cuMemFreeAsync = windll.GetProcAddress(handle, 'cuMemFreeAsync') {{endif}} {{if 'cuMemAllocAsync' in found_functions}} - try: - global __cuMemAllocAsync - __cuMemAllocAsync = win32api.GetProcAddress(handle, 'cuMemAllocAsync') - except: - pass + global __cuMemAllocAsync + __cuMemAllocAsync = windll.GetProcAddress(handle, 'cuMemAllocAsync') {{endif}} {{if 'cuMemAllocFromPoolAsync' in found_functions}} - try: - global __cuMemAllocFromPoolAsync - __cuMemAllocFromPoolAsync = win32api.GetProcAddress(handle, 'cuMemAllocFromPoolAsync') - except: - pass + global __cuMemAllocFromPoolAsync + __cuMemAllocFromPoolAsync = windll.GetProcAddress(handle, 'cuMemAllocFromPoolAsync') {{endif}} {{if 'cuMemPrefetchAsync_v2' in found_functions}} - try: - global __cuMemPrefetchAsync_v2 - __cuMemPrefetchAsync_v2 = win32api.GetProcAddress(handle, 'cuMemPrefetchAsync_v2') - except: - pass + global __cuMemPrefetchAsync_v2 + __cuMemPrefetchAsync_v2 = windll.GetProcAddress(handle, 'cuMemPrefetchAsync_v2') {{endif}} {{if 'cuMemPrefetchBatchAsync' in found_functions}} - try: - global __cuMemPrefetchBatchAsync - __cuMemPrefetchBatchAsync = win32api.GetProcAddress(handle, 'cuMemPrefetchBatchAsync') - except: - pass + global __cuMemPrefetchBatchAsync + __cuMemPrefetchBatchAsync = windll.GetProcAddress(handle, 'cuMemPrefetchBatchAsync') {{endif}} {{if 'cuMemDiscardBatchAsync' in found_functions}} - try: - global __cuMemDiscardBatchAsync - __cuMemDiscardBatchAsync = win32api.GetProcAddress(handle, 'cuMemDiscardBatchAsync') - except: - pass + global __cuMemDiscardBatchAsync + __cuMemDiscardBatchAsync = windll.GetProcAddress(handle, 'cuMemDiscardBatchAsync') {{endif}} {{if 'cuMemDiscardAndPrefetchBatchAsync' in found_functions}} - try: - global __cuMemDiscardAndPrefetchBatchAsync - __cuMemDiscardAndPrefetchBatchAsync = win32api.GetProcAddress(handle, 'cuMemDiscardAndPrefetchBatchAsync') - except: - pass + global __cuMemDiscardAndPrefetchBatchAsync + __cuMemDiscardAndPrefetchBatchAsync = windll.GetProcAddress(handle, 'cuMemDiscardAndPrefetchBatchAsync') {{endif}} {{if 'cuStreamGetPriority' in found_functions}} - try: - global __cuStreamGetPriority - __cuStreamGetPriority = win32api.GetProcAddress(handle, 'cuStreamGetPriority') - except: - pass + global __cuStreamGetPriority + __cuStreamGetPriority = windll.GetProcAddress(handle, 'cuStreamGetPriority') {{endif}} {{if 'cuStreamGetDevice' in found_functions}} - try: - global __cuStreamGetDevice - __cuStreamGetDevice = win32api.GetProcAddress(handle, 'cuStreamGetDevice') - except: - pass + global __cuStreamGetDevice + __cuStreamGetDevice = windll.GetProcAddress(handle, 'cuStreamGetDevice') {{endif}} {{if 'cuStreamGetFlags' in found_functions}} - try: - global __cuStreamGetFlags - __cuStreamGetFlags = win32api.GetProcAddress(handle, 'cuStreamGetFlags') - except: - pass + global __cuStreamGetFlags + __cuStreamGetFlags = windll.GetProcAddress(handle, 'cuStreamGetFlags') {{endif}} {{if 'cuStreamGetId' in found_functions}} - try: - global __cuStreamGetId - __cuStreamGetId = win32api.GetProcAddress(handle, 'cuStreamGetId') - except: - pass + global __cuStreamGetId + __cuStreamGetId = windll.GetProcAddress(handle, 'cuStreamGetId') {{endif}} {{if 'cuStreamGetCtx' in found_functions}} - try: - global __cuStreamGetCtx - __cuStreamGetCtx = win32api.GetProcAddress(handle, 'cuStreamGetCtx') - except: - pass + global __cuStreamGetCtx + __cuStreamGetCtx = windll.GetProcAddress(handle, 'cuStreamGetCtx') {{endif}} {{if 'cuStreamGetCtx_v2' in found_functions}} - try: - global __cuStreamGetCtx_v2 - __cuStreamGetCtx_v2 = win32api.GetProcAddress(handle, 'cuStreamGetCtx_v2') - except: - pass + global __cuStreamGetCtx_v2 + __cuStreamGetCtx_v2 = windll.GetProcAddress(handle, 'cuStreamGetCtx_v2') {{endif}} {{if 'cuStreamWaitEvent' in found_functions}} - try: - global __cuStreamWaitEvent - __cuStreamWaitEvent = win32api.GetProcAddress(handle, 'cuStreamWaitEvent') - except: - pass + global __cuStreamWaitEvent + __cuStreamWaitEvent = windll.GetProcAddress(handle, 'cuStreamWaitEvent') {{endif}} {{if 'cuStreamAddCallback' in found_functions}} - try: - global __cuStreamAddCallback - __cuStreamAddCallback = win32api.GetProcAddress(handle, 'cuStreamAddCallback') - except: - pass + global __cuStreamAddCallback + __cuStreamAddCallback = windll.GetProcAddress(handle, 'cuStreamAddCallback') {{endif}} {{if 'cuStreamBeginCapture_v2' in found_functions}} - try: - global __cuStreamBeginCapture_v2 - __cuStreamBeginCapture_v2 = win32api.GetProcAddress(handle, 'cuStreamBeginCapture_v2') - except: - pass + global __cuStreamBeginCapture_v2 + __cuStreamBeginCapture_v2 = windll.GetProcAddress(handle, 'cuStreamBeginCapture_v2') {{endif}} {{if 'cuStreamBeginCaptureToGraph' in found_functions}} - try: - global __cuStreamBeginCaptureToGraph - __cuStreamBeginCaptureToGraph = win32api.GetProcAddress(handle, 'cuStreamBeginCaptureToGraph') - except: - pass + global __cuStreamBeginCaptureToGraph + __cuStreamBeginCaptureToGraph = windll.GetProcAddress(handle, 'cuStreamBeginCaptureToGraph') {{endif}} {{if 'cuStreamEndCapture' in found_functions}} - try: - global __cuStreamEndCapture - __cuStreamEndCapture = win32api.GetProcAddress(handle, 'cuStreamEndCapture') - except: - pass + global __cuStreamEndCapture + __cuStreamEndCapture = windll.GetProcAddress(handle, 'cuStreamEndCapture') {{endif}} {{if 'cuStreamIsCapturing' in found_functions}} - try: - global __cuStreamIsCapturing - __cuStreamIsCapturing = win32api.GetProcAddress(handle, 'cuStreamIsCapturing') - except: - pass + global __cuStreamIsCapturing + __cuStreamIsCapturing = windll.GetProcAddress(handle, 'cuStreamIsCapturing') {{endif}} {{if 'cuStreamGetCaptureInfo_v3' in found_functions}} - try: - global __cuStreamGetCaptureInfo_v3 - __cuStreamGetCaptureInfo_v3 = win32api.GetProcAddress(handle, 'cuStreamGetCaptureInfo_v3') - except: - pass + global __cuStreamGetCaptureInfo_v3 + __cuStreamGetCaptureInfo_v3 = windll.GetProcAddress(handle, 'cuStreamGetCaptureInfo_v3') {{endif}} {{if 'cuStreamUpdateCaptureDependencies_v2' in found_functions}} - try: - global __cuStreamUpdateCaptureDependencies_v2 - __cuStreamUpdateCaptureDependencies_v2 = win32api.GetProcAddress(handle, 'cuStreamUpdateCaptureDependencies_v2') - except: - pass + global __cuStreamUpdateCaptureDependencies_v2 + __cuStreamUpdateCaptureDependencies_v2 = windll.GetProcAddress(handle, 'cuStreamUpdateCaptureDependencies_v2') {{endif}} {{if 'cuStreamAttachMemAsync' in found_functions}} - try: - global __cuStreamAttachMemAsync - __cuStreamAttachMemAsync = win32api.GetProcAddress(handle, 'cuStreamAttachMemAsync') - except: - pass + global __cuStreamAttachMemAsync + __cuStreamAttachMemAsync = windll.GetProcAddress(handle, 'cuStreamAttachMemAsync') {{endif}} {{if 'cuStreamQuery' in found_functions}} - try: - global __cuStreamQuery - __cuStreamQuery = win32api.GetProcAddress(handle, 'cuStreamQuery') - except: - pass + global __cuStreamQuery + __cuStreamQuery = windll.GetProcAddress(handle, 'cuStreamQuery') {{endif}} {{if 'cuStreamSynchronize' in found_functions}} - try: - global __cuStreamSynchronize - __cuStreamSynchronize = win32api.GetProcAddress(handle, 'cuStreamSynchronize') - except: - pass + global __cuStreamSynchronize + __cuStreamSynchronize = windll.GetProcAddress(handle, 'cuStreamSynchronize') {{endif}} {{if 'cuStreamCopyAttributes' in found_functions}} - try: - global __cuStreamCopyAttributes - __cuStreamCopyAttributes = win32api.GetProcAddress(handle, 'cuStreamCopyAttributes') - except: - pass + global __cuStreamCopyAttributes + __cuStreamCopyAttributes = windll.GetProcAddress(handle, 'cuStreamCopyAttributes') {{endif}} {{if 'cuStreamGetAttribute' in found_functions}} - try: - global __cuStreamGetAttribute - __cuStreamGetAttribute = win32api.GetProcAddress(handle, 'cuStreamGetAttribute') - except: - pass + global __cuStreamGetAttribute + __cuStreamGetAttribute = windll.GetProcAddress(handle, 'cuStreamGetAttribute') {{endif}} {{if 'cuStreamSetAttribute' in found_functions}} - try: - global __cuStreamSetAttribute - __cuStreamSetAttribute = win32api.GetProcAddress(handle, 'cuStreamSetAttribute') - except: - pass + global __cuStreamSetAttribute + __cuStreamSetAttribute = windll.GetProcAddress(handle, 'cuStreamSetAttribute') {{endif}} {{if 'cuEventRecord' in found_functions}} - try: - global __cuEventRecord - __cuEventRecord = win32api.GetProcAddress(handle, 'cuEventRecord') - except: - pass + global __cuEventRecord + __cuEventRecord = windll.GetProcAddress(handle, 'cuEventRecord') {{endif}} {{if 'cuEventRecordWithFlags' in found_functions}} - try: - global __cuEventRecordWithFlags - __cuEventRecordWithFlags = win32api.GetProcAddress(handle, 'cuEventRecordWithFlags') - except: - pass + global __cuEventRecordWithFlags + __cuEventRecordWithFlags = windll.GetProcAddress(handle, 'cuEventRecordWithFlags') {{endif}} {{if 'cuSignalExternalSemaphoresAsync' in found_functions}} - try: - global __cuSignalExternalSemaphoresAsync - __cuSignalExternalSemaphoresAsync = win32api.GetProcAddress(handle, 'cuSignalExternalSemaphoresAsync') - except: - pass + global __cuSignalExternalSemaphoresAsync + __cuSignalExternalSemaphoresAsync = windll.GetProcAddress(handle, 'cuSignalExternalSemaphoresAsync') {{endif}} {{if 'cuWaitExternalSemaphoresAsync' in found_functions}} - try: - global __cuWaitExternalSemaphoresAsync - __cuWaitExternalSemaphoresAsync = win32api.GetProcAddress(handle, 'cuWaitExternalSemaphoresAsync') - except: - pass + global __cuWaitExternalSemaphoresAsync + __cuWaitExternalSemaphoresAsync = windll.GetProcAddress(handle, 'cuWaitExternalSemaphoresAsync') {{endif}} {{if 'cuStreamWaitValue32_v2' in found_functions}} - try: - global __cuStreamWaitValue32_v2 - __cuStreamWaitValue32_v2 = win32api.GetProcAddress(handle, 'cuStreamWaitValue32_v2') - except: - pass + global __cuStreamWaitValue32_v2 + __cuStreamWaitValue32_v2 = windll.GetProcAddress(handle, 'cuStreamWaitValue32_v2') {{endif}} {{if 'cuStreamWaitValue64_v2' in found_functions}} - try: - global __cuStreamWaitValue64_v2 - __cuStreamWaitValue64_v2 = win32api.GetProcAddress(handle, 'cuStreamWaitValue64_v2') - except: - pass + global __cuStreamWaitValue64_v2 + __cuStreamWaitValue64_v2 = windll.GetProcAddress(handle, 'cuStreamWaitValue64_v2') {{endif}} {{if 'cuStreamWriteValue32_v2' in found_functions}} - try: - global __cuStreamWriteValue32_v2 - __cuStreamWriteValue32_v2 = win32api.GetProcAddress(handle, 'cuStreamWriteValue32_v2') - except: - pass + global __cuStreamWriteValue32_v2 + __cuStreamWriteValue32_v2 = windll.GetProcAddress(handle, 'cuStreamWriteValue32_v2') {{endif}} {{if 'cuStreamWriteValue64_v2' in found_functions}} - try: - global __cuStreamWriteValue64_v2 - __cuStreamWriteValue64_v2 = win32api.GetProcAddress(handle, 'cuStreamWriteValue64_v2') - except: - pass + global __cuStreamWriteValue64_v2 + __cuStreamWriteValue64_v2 = windll.GetProcAddress(handle, 'cuStreamWriteValue64_v2') {{endif}} {{if 'cuStreamBatchMemOp_v2' in found_functions}} - try: - global __cuStreamBatchMemOp_v2 - __cuStreamBatchMemOp_v2 = win32api.GetProcAddress(handle, 'cuStreamBatchMemOp_v2') - except: - pass + global __cuStreamBatchMemOp_v2 + __cuStreamBatchMemOp_v2 = windll.GetProcAddress(handle, 'cuStreamBatchMemOp_v2') {{endif}} {{if 'cuLaunchKernel' in found_functions}} - try: - global __cuLaunchKernel - __cuLaunchKernel = win32api.GetProcAddress(handle, 'cuLaunchKernel') - except: - pass + global __cuLaunchKernel + __cuLaunchKernel = windll.GetProcAddress(handle, 'cuLaunchKernel') {{endif}} {{if 'cuLaunchKernelEx' in found_functions}} - try: - global __cuLaunchKernelEx - __cuLaunchKernelEx = win32api.GetProcAddress(handle, 'cuLaunchKernelEx') - except: - pass + global __cuLaunchKernelEx + __cuLaunchKernelEx = windll.GetProcAddress(handle, 'cuLaunchKernelEx') {{endif}} {{if 'cuLaunchCooperativeKernel' in found_functions}} - try: - global __cuLaunchCooperativeKernel - __cuLaunchCooperativeKernel = win32api.GetProcAddress(handle, 'cuLaunchCooperativeKernel') - except: - pass + global __cuLaunchCooperativeKernel + __cuLaunchCooperativeKernel = windll.GetProcAddress(handle, 'cuLaunchCooperativeKernel') {{endif}} {{if 'cuLaunchHostFunc' in found_functions}} - try: - global __cuLaunchHostFunc - __cuLaunchHostFunc = win32api.GetProcAddress(handle, 'cuLaunchHostFunc') - except: - pass + global __cuLaunchHostFunc + __cuLaunchHostFunc = windll.GetProcAddress(handle, 'cuLaunchHostFunc') {{endif}} {{if 'cuGraphInstantiateWithParams' in found_functions}} - try: - global __cuGraphInstantiateWithParams - __cuGraphInstantiateWithParams = win32api.GetProcAddress(handle, 'cuGraphInstantiateWithParams') - except: - pass + global __cuGraphInstantiateWithParams + __cuGraphInstantiateWithParams = windll.GetProcAddress(handle, 'cuGraphInstantiateWithParams') {{endif}} {{if 'cuGraphUpload' in found_functions}} - try: - global __cuGraphUpload - __cuGraphUpload = win32api.GetProcAddress(handle, 'cuGraphUpload') - except: - pass + global __cuGraphUpload + __cuGraphUpload = windll.GetProcAddress(handle, 'cuGraphUpload') {{endif}} {{if 'cuGraphLaunch' in found_functions}} - try: - global __cuGraphLaunch - __cuGraphLaunch = win32api.GetProcAddress(handle, 'cuGraphLaunch') - except: - pass + global __cuGraphLaunch + __cuGraphLaunch = windll.GetProcAddress(handle, 'cuGraphLaunch') {{endif}} {{if 'cuGraphicsMapResources' in found_functions}} - try: - global __cuGraphicsMapResources - __cuGraphicsMapResources = win32api.GetProcAddress(handle, 'cuGraphicsMapResources') - except: - pass + global __cuGraphicsMapResources + __cuGraphicsMapResources = windll.GetProcAddress(handle, 'cuGraphicsMapResources') {{endif}} {{if 'cuGraphicsUnmapResources' in found_functions}} - try: - global __cuGraphicsUnmapResources - __cuGraphicsUnmapResources = win32api.GetProcAddress(handle, 'cuGraphicsUnmapResources') - except: - pass + global __cuGraphicsUnmapResources + __cuGraphicsUnmapResources = windll.GetProcAddress(handle, 'cuGraphicsUnmapResources') {{endif}} # Get remaining functions {{if 'cuGetErrorString' in found_functions}} - try: - global __cuGetErrorString - __cuGetErrorString = win32api.GetProcAddress(handle, 'cuGetErrorString') - except: - pass + global __cuGetErrorString + __cuGetErrorString = windll.GetProcAddress(handle, 'cuGetErrorString') {{endif}} {{if 'cuGetErrorName' in found_functions}} - try: - global __cuGetErrorName - __cuGetErrorName = win32api.GetProcAddress(handle, 'cuGetErrorName') - except: - pass + global __cuGetErrorName + __cuGetErrorName = windll.GetProcAddress(handle, 'cuGetErrorName') {{endif}} {{if 'cuInit' in found_functions}} - try: - global __cuInit - __cuInit = win32api.GetProcAddress(handle, 'cuInit') - except: - pass + global __cuInit + __cuInit = windll.GetProcAddress(handle, 'cuInit') {{endif}} {{if 'cuDriverGetVersion' in found_functions}} - try: - global __cuDriverGetVersion - __cuDriverGetVersion = win32api.GetProcAddress(handle, 'cuDriverGetVersion') - except: - pass + global __cuDriverGetVersion + __cuDriverGetVersion = windll.GetProcAddress(handle, 'cuDriverGetVersion') {{endif}} {{if 'cuDeviceGet' in found_functions}} - try: - global __cuDeviceGet - __cuDeviceGet = win32api.GetProcAddress(handle, 'cuDeviceGet') - except: - pass + global __cuDeviceGet + __cuDeviceGet = windll.GetProcAddress(handle, 'cuDeviceGet') {{endif}} {{if 'cuDeviceGetCount' in found_functions}} - try: - global __cuDeviceGetCount - __cuDeviceGetCount = win32api.GetProcAddress(handle, 'cuDeviceGetCount') - except: - pass + global __cuDeviceGetCount + __cuDeviceGetCount = windll.GetProcAddress(handle, 'cuDeviceGetCount') {{endif}} {{if 'cuDeviceGetName' in found_functions}} - try: - global __cuDeviceGetName - __cuDeviceGetName = win32api.GetProcAddress(handle, 'cuDeviceGetName') - except: - pass + global __cuDeviceGetName + __cuDeviceGetName = windll.GetProcAddress(handle, 'cuDeviceGetName') {{endif}} {{if 'cuDeviceGetUuid_v2' in found_functions}} - try: - global __cuDeviceGetUuid_v2 - __cuDeviceGetUuid_v2 = win32api.GetProcAddress(handle, 'cuDeviceGetUuid_v2') - except: - pass + global __cuDeviceGetUuid_v2 + __cuDeviceGetUuid_v2 = windll.GetProcAddress(handle, 'cuDeviceGetUuid_v2') {{endif}} {{if 'cuDeviceGetLuid' in found_functions}} - try: - global __cuDeviceGetLuid - __cuDeviceGetLuid = win32api.GetProcAddress(handle, 'cuDeviceGetLuid') - except: - pass + global __cuDeviceGetLuid + __cuDeviceGetLuid = windll.GetProcAddress(handle, 'cuDeviceGetLuid') {{endif}} {{if 'cuDeviceTotalMem_v2' in found_functions}} - try: - global __cuDeviceTotalMem_v2 - __cuDeviceTotalMem_v2 = win32api.GetProcAddress(handle, 'cuDeviceTotalMem_v2') - except: - pass + global __cuDeviceTotalMem_v2 + __cuDeviceTotalMem_v2 = windll.GetProcAddress(handle, 'cuDeviceTotalMem_v2') {{endif}} {{if 'cuDeviceGetTexture1DLinearMaxWidth' in found_functions}} - try: - global __cuDeviceGetTexture1DLinearMaxWidth - __cuDeviceGetTexture1DLinearMaxWidth = win32api.GetProcAddress(handle, 'cuDeviceGetTexture1DLinearMaxWidth') - except: - pass + global __cuDeviceGetTexture1DLinearMaxWidth + __cuDeviceGetTexture1DLinearMaxWidth = windll.GetProcAddress(handle, 'cuDeviceGetTexture1DLinearMaxWidth') {{endif}} {{if 'cuDeviceGetAttribute' in found_functions}} - try: - global __cuDeviceGetAttribute - __cuDeviceGetAttribute = win32api.GetProcAddress(handle, 'cuDeviceGetAttribute') - except: - pass + global __cuDeviceGetAttribute + __cuDeviceGetAttribute = windll.GetProcAddress(handle, 'cuDeviceGetAttribute') {{endif}} {{if 'cuDeviceGetHostAtomicCapabilities' in found_functions}} - try: - global __cuDeviceGetHostAtomicCapabilities - __cuDeviceGetHostAtomicCapabilities = win32api.GetProcAddress(handle, 'cuDeviceGetHostAtomicCapabilities') - except: - pass + global __cuDeviceGetHostAtomicCapabilities + __cuDeviceGetHostAtomicCapabilities = windll.GetProcAddress(handle, 'cuDeviceGetHostAtomicCapabilities') {{endif}} {{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}} - try: - global __cuDeviceGetNvSciSyncAttributes - __cuDeviceGetNvSciSyncAttributes = win32api.GetProcAddress(handle, 'cuDeviceGetNvSciSyncAttributes') - except: - pass + global __cuDeviceGetNvSciSyncAttributes + __cuDeviceGetNvSciSyncAttributes = windll.GetProcAddress(handle, 'cuDeviceGetNvSciSyncAttributes') {{endif}} {{if 'cuDeviceSetMemPool' in found_functions}} - try: - global __cuDeviceSetMemPool - __cuDeviceSetMemPool = win32api.GetProcAddress(handle, 'cuDeviceSetMemPool') - except: - pass + global __cuDeviceSetMemPool + __cuDeviceSetMemPool = windll.GetProcAddress(handle, 'cuDeviceSetMemPool') {{endif}} {{if 'cuDeviceGetMemPool' in found_functions}} - try: - global __cuDeviceGetMemPool - __cuDeviceGetMemPool = win32api.GetProcAddress(handle, 'cuDeviceGetMemPool') - except: - pass + global __cuDeviceGetMemPool + __cuDeviceGetMemPool = windll.GetProcAddress(handle, 'cuDeviceGetMemPool') {{endif}} {{if 'cuDeviceGetDefaultMemPool' in found_functions}} - try: - global __cuDeviceGetDefaultMemPool - __cuDeviceGetDefaultMemPool = win32api.GetProcAddress(handle, 'cuDeviceGetDefaultMemPool') - except: - pass + global __cuDeviceGetDefaultMemPool + __cuDeviceGetDefaultMemPool = windll.GetProcAddress(handle, 'cuDeviceGetDefaultMemPool') {{endif}} {{if 'cuDeviceGetExecAffinitySupport' in found_functions}} - try: - global __cuDeviceGetExecAffinitySupport - __cuDeviceGetExecAffinitySupport = win32api.GetProcAddress(handle, 'cuDeviceGetExecAffinitySupport') - except: - pass + global __cuDeviceGetExecAffinitySupport + __cuDeviceGetExecAffinitySupport = windll.GetProcAddress(handle, 'cuDeviceGetExecAffinitySupport') {{endif}} {{if 'cuFlushGPUDirectRDMAWrites' in found_functions}} - try: - global __cuFlushGPUDirectRDMAWrites - __cuFlushGPUDirectRDMAWrites = win32api.GetProcAddress(handle, 'cuFlushGPUDirectRDMAWrites') - except: - pass + global __cuFlushGPUDirectRDMAWrites + __cuFlushGPUDirectRDMAWrites = windll.GetProcAddress(handle, 'cuFlushGPUDirectRDMAWrites') {{endif}} {{if 'cuDeviceGetProperties' in found_functions}} - try: - global __cuDeviceGetProperties - __cuDeviceGetProperties = win32api.GetProcAddress(handle, 'cuDeviceGetProperties') - except: - pass + global __cuDeviceGetProperties + __cuDeviceGetProperties = windll.GetProcAddress(handle, 'cuDeviceGetProperties') {{endif}} {{if 'cuDeviceComputeCapability' in found_functions}} - try: - global __cuDeviceComputeCapability - __cuDeviceComputeCapability = win32api.GetProcAddress(handle, 'cuDeviceComputeCapability') - except: - pass + global __cuDeviceComputeCapability + __cuDeviceComputeCapability = windll.GetProcAddress(handle, 'cuDeviceComputeCapability') {{endif}} {{if 'cuDevicePrimaryCtxRetain' in found_functions}} - try: - global __cuDevicePrimaryCtxRetain - __cuDevicePrimaryCtxRetain = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxRetain') - except: - pass + global __cuDevicePrimaryCtxRetain + __cuDevicePrimaryCtxRetain = windll.GetProcAddress(handle, 'cuDevicePrimaryCtxRetain') {{endif}} {{if 'cuDevicePrimaryCtxRelease_v2' in found_functions}} - try: - global __cuDevicePrimaryCtxRelease_v2 - __cuDevicePrimaryCtxRelease_v2 = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxRelease_v2') - except: - pass + global __cuDevicePrimaryCtxRelease_v2 + __cuDevicePrimaryCtxRelease_v2 = windll.GetProcAddress(handle, 'cuDevicePrimaryCtxRelease_v2') {{endif}} {{if 'cuDevicePrimaryCtxSetFlags_v2' in found_functions}} - try: - global __cuDevicePrimaryCtxSetFlags_v2 - __cuDevicePrimaryCtxSetFlags_v2 = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxSetFlags_v2') - except: - pass + global __cuDevicePrimaryCtxSetFlags_v2 + __cuDevicePrimaryCtxSetFlags_v2 = windll.GetProcAddress(handle, 'cuDevicePrimaryCtxSetFlags_v2') {{endif}} {{if 'cuDevicePrimaryCtxGetState' in found_functions}} - try: - global __cuDevicePrimaryCtxGetState - __cuDevicePrimaryCtxGetState = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxGetState') - except: - pass + global __cuDevicePrimaryCtxGetState + __cuDevicePrimaryCtxGetState = windll.GetProcAddress(handle, 'cuDevicePrimaryCtxGetState') {{endif}} {{if 'cuDevicePrimaryCtxReset_v2' in found_functions}} - try: - global __cuDevicePrimaryCtxReset_v2 - __cuDevicePrimaryCtxReset_v2 = win32api.GetProcAddress(handle, 'cuDevicePrimaryCtxReset_v2') - except: - pass + global __cuDevicePrimaryCtxReset_v2 + __cuDevicePrimaryCtxReset_v2 = windll.GetProcAddress(handle, 'cuDevicePrimaryCtxReset_v2') {{endif}} {{if 'cuCtxCreate_v4' in found_functions}} - try: - global __cuCtxCreate_v4 - __cuCtxCreate_v4 = win32api.GetProcAddress(handle, 'cuCtxCreate_v4') - except: - pass + global __cuCtxCreate_v4 + __cuCtxCreate_v4 = windll.GetProcAddress(handle, 'cuCtxCreate_v4') {{endif}} {{if 'cuCtxDestroy_v2' in found_functions}} - try: - global __cuCtxDestroy_v2 - __cuCtxDestroy_v2 = win32api.GetProcAddress(handle, 'cuCtxDestroy_v2') - except: - pass + global __cuCtxDestroy_v2 + __cuCtxDestroy_v2 = windll.GetProcAddress(handle, 'cuCtxDestroy_v2') {{endif}} {{if 'cuCtxPushCurrent_v2' in found_functions}} - try: - global __cuCtxPushCurrent_v2 - __cuCtxPushCurrent_v2 = win32api.GetProcAddress(handle, 'cuCtxPushCurrent_v2') - except: - pass + global __cuCtxPushCurrent_v2 + __cuCtxPushCurrent_v2 = windll.GetProcAddress(handle, 'cuCtxPushCurrent_v2') {{endif}} {{if 'cuCtxPopCurrent_v2' in found_functions}} - try: - global __cuCtxPopCurrent_v2 - __cuCtxPopCurrent_v2 = win32api.GetProcAddress(handle, 'cuCtxPopCurrent_v2') - except: - pass + global __cuCtxPopCurrent_v2 + __cuCtxPopCurrent_v2 = windll.GetProcAddress(handle, 'cuCtxPopCurrent_v2') {{endif}} {{if 'cuCtxSetCurrent' in found_functions}} - try: - global __cuCtxSetCurrent - __cuCtxSetCurrent = win32api.GetProcAddress(handle, 'cuCtxSetCurrent') - except: - pass + global __cuCtxSetCurrent + __cuCtxSetCurrent = windll.GetProcAddress(handle, 'cuCtxSetCurrent') {{endif}} {{if 'cuCtxGetCurrent' in found_functions}} - try: - global __cuCtxGetCurrent - __cuCtxGetCurrent = win32api.GetProcAddress(handle, 'cuCtxGetCurrent') - except: - pass + global __cuCtxGetCurrent + __cuCtxGetCurrent = windll.GetProcAddress(handle, 'cuCtxGetCurrent') {{endif}} {{if 'cuCtxGetDevice' in found_functions}} - try: - global __cuCtxGetDevice - __cuCtxGetDevice = win32api.GetProcAddress(handle, 'cuCtxGetDevice') - except: - pass + global __cuCtxGetDevice + __cuCtxGetDevice = windll.GetProcAddress(handle, 'cuCtxGetDevice') {{endif}} {{if 'cuCtxGetDevice_v2' in found_functions}} - try: - global __cuCtxGetDevice_v2 - __cuCtxGetDevice_v2 = win32api.GetProcAddress(handle, 'cuCtxGetDevice_v2') - except: - pass + global __cuCtxGetDevice_v2 + __cuCtxGetDevice_v2 = windll.GetProcAddress(handle, 'cuCtxGetDevice_v2') {{endif}} {{if 'cuCtxGetFlags' in found_functions}} - try: - global __cuCtxGetFlags - __cuCtxGetFlags = win32api.GetProcAddress(handle, 'cuCtxGetFlags') - except: - pass + global __cuCtxGetFlags + __cuCtxGetFlags = windll.GetProcAddress(handle, 'cuCtxGetFlags') {{endif}} {{if 'cuCtxSetFlags' in found_functions}} - try: - global __cuCtxSetFlags - __cuCtxSetFlags = win32api.GetProcAddress(handle, 'cuCtxSetFlags') - except: - pass + global __cuCtxSetFlags + __cuCtxSetFlags = windll.GetProcAddress(handle, 'cuCtxSetFlags') {{endif}} {{if 'cuCtxGetId' in found_functions}} - try: - global __cuCtxGetId - __cuCtxGetId = win32api.GetProcAddress(handle, 'cuCtxGetId') - except: - pass + global __cuCtxGetId + __cuCtxGetId = windll.GetProcAddress(handle, 'cuCtxGetId') {{endif}} {{if 'cuCtxSynchronize' in found_functions}} - try: - global __cuCtxSynchronize - __cuCtxSynchronize = win32api.GetProcAddress(handle, 'cuCtxSynchronize') - except: - pass + global __cuCtxSynchronize + __cuCtxSynchronize = windll.GetProcAddress(handle, 'cuCtxSynchronize') {{endif}} {{if 'cuCtxSynchronize_v2' in found_functions}} - try: - global __cuCtxSynchronize_v2 - __cuCtxSynchronize_v2 = win32api.GetProcAddress(handle, 'cuCtxSynchronize_v2') - except: - pass + global __cuCtxSynchronize_v2 + __cuCtxSynchronize_v2 = windll.GetProcAddress(handle, 'cuCtxSynchronize_v2') {{endif}} {{if 'cuCtxSetLimit' in found_functions}} - try: - global __cuCtxSetLimit - __cuCtxSetLimit = win32api.GetProcAddress(handle, 'cuCtxSetLimit') - except: - pass + global __cuCtxSetLimit + __cuCtxSetLimit = windll.GetProcAddress(handle, 'cuCtxSetLimit') {{endif}} {{if 'cuCtxGetLimit' in found_functions}} - try: - global __cuCtxGetLimit - __cuCtxGetLimit = win32api.GetProcAddress(handle, 'cuCtxGetLimit') - except: - pass + global __cuCtxGetLimit + __cuCtxGetLimit = windll.GetProcAddress(handle, 'cuCtxGetLimit') {{endif}} {{if 'cuCtxGetCacheConfig' in found_functions}} - try: - global __cuCtxGetCacheConfig - __cuCtxGetCacheConfig = win32api.GetProcAddress(handle, 'cuCtxGetCacheConfig') - except: - pass + global __cuCtxGetCacheConfig + __cuCtxGetCacheConfig = windll.GetProcAddress(handle, 'cuCtxGetCacheConfig') {{endif}} {{if 'cuCtxSetCacheConfig' in found_functions}} - try: - global __cuCtxSetCacheConfig - __cuCtxSetCacheConfig = win32api.GetProcAddress(handle, 'cuCtxSetCacheConfig') - except: - pass + global __cuCtxSetCacheConfig + __cuCtxSetCacheConfig = windll.GetProcAddress(handle, 'cuCtxSetCacheConfig') {{endif}} {{if 'cuCtxGetApiVersion' in found_functions}} - try: - global __cuCtxGetApiVersion - __cuCtxGetApiVersion = win32api.GetProcAddress(handle, 'cuCtxGetApiVersion') - except: - pass + global __cuCtxGetApiVersion + __cuCtxGetApiVersion = windll.GetProcAddress(handle, 'cuCtxGetApiVersion') {{endif}} {{if 'cuCtxGetStreamPriorityRange' in found_functions}} - try: - global __cuCtxGetStreamPriorityRange - __cuCtxGetStreamPriorityRange = win32api.GetProcAddress(handle, 'cuCtxGetStreamPriorityRange') - except: - pass + global __cuCtxGetStreamPriorityRange + __cuCtxGetStreamPriorityRange = windll.GetProcAddress(handle, 'cuCtxGetStreamPriorityRange') {{endif}} {{if 'cuCtxResetPersistingL2Cache' in found_functions}} - try: - global __cuCtxResetPersistingL2Cache - __cuCtxResetPersistingL2Cache = win32api.GetProcAddress(handle, 'cuCtxResetPersistingL2Cache') - except: - pass + global __cuCtxResetPersistingL2Cache + __cuCtxResetPersistingL2Cache = windll.GetProcAddress(handle, 'cuCtxResetPersistingL2Cache') {{endif}} {{if 'cuCtxGetExecAffinity' in found_functions}} - try: - global __cuCtxGetExecAffinity - __cuCtxGetExecAffinity = win32api.GetProcAddress(handle, 'cuCtxGetExecAffinity') - except: - pass + global __cuCtxGetExecAffinity + __cuCtxGetExecAffinity = windll.GetProcAddress(handle, 'cuCtxGetExecAffinity') {{endif}} {{if 'cuCtxRecordEvent' in found_functions}} - try: - global __cuCtxRecordEvent - __cuCtxRecordEvent = win32api.GetProcAddress(handle, 'cuCtxRecordEvent') - except: - pass + global __cuCtxRecordEvent + __cuCtxRecordEvent = windll.GetProcAddress(handle, 'cuCtxRecordEvent') {{endif}} {{if 'cuCtxWaitEvent' in found_functions}} - try: - global __cuCtxWaitEvent - __cuCtxWaitEvent = win32api.GetProcAddress(handle, 'cuCtxWaitEvent') - except: - pass + global __cuCtxWaitEvent + __cuCtxWaitEvent = windll.GetProcAddress(handle, 'cuCtxWaitEvent') {{endif}} {{if 'cuCtxAttach' in found_functions}} - try: - global __cuCtxAttach - __cuCtxAttach = win32api.GetProcAddress(handle, 'cuCtxAttach') - except: - pass + global __cuCtxAttach + __cuCtxAttach = windll.GetProcAddress(handle, 'cuCtxAttach') {{endif}} {{if 'cuCtxDetach' in found_functions}} - try: - global __cuCtxDetach - __cuCtxDetach = win32api.GetProcAddress(handle, 'cuCtxDetach') - except: - pass + global __cuCtxDetach + __cuCtxDetach = windll.GetProcAddress(handle, 'cuCtxDetach') {{endif}} {{if 'cuCtxGetSharedMemConfig' in found_functions}} - try: - global __cuCtxGetSharedMemConfig - __cuCtxGetSharedMemConfig = win32api.GetProcAddress(handle, 'cuCtxGetSharedMemConfig') - except: - pass + global __cuCtxGetSharedMemConfig + __cuCtxGetSharedMemConfig = windll.GetProcAddress(handle, 'cuCtxGetSharedMemConfig') {{endif}} {{if 'cuCtxSetSharedMemConfig' in found_functions}} - try: - global __cuCtxSetSharedMemConfig - __cuCtxSetSharedMemConfig = win32api.GetProcAddress(handle, 'cuCtxSetSharedMemConfig') - except: - pass + global __cuCtxSetSharedMemConfig + __cuCtxSetSharedMemConfig = windll.GetProcAddress(handle, 'cuCtxSetSharedMemConfig') {{endif}} {{if 'cuModuleLoad' in found_functions}} - try: - global __cuModuleLoad - __cuModuleLoad = win32api.GetProcAddress(handle, 'cuModuleLoad') - except: - pass + global __cuModuleLoad + __cuModuleLoad = windll.GetProcAddress(handle, 'cuModuleLoad') {{endif}} {{if 'cuModuleLoadData' in found_functions}} - try: - global __cuModuleLoadData - __cuModuleLoadData = win32api.GetProcAddress(handle, 'cuModuleLoadData') - except: - pass + global __cuModuleLoadData + __cuModuleLoadData = windll.GetProcAddress(handle, 'cuModuleLoadData') {{endif}} {{if 'cuModuleLoadDataEx' in found_functions}} - try: - global __cuModuleLoadDataEx - __cuModuleLoadDataEx = win32api.GetProcAddress(handle, 'cuModuleLoadDataEx') - except: - pass + global __cuModuleLoadDataEx + __cuModuleLoadDataEx = windll.GetProcAddress(handle, 'cuModuleLoadDataEx') {{endif}} {{if 'cuModuleLoadFatBinary' in found_functions}} - try: - global __cuModuleLoadFatBinary - __cuModuleLoadFatBinary = win32api.GetProcAddress(handle, 'cuModuleLoadFatBinary') - except: - pass + global __cuModuleLoadFatBinary + __cuModuleLoadFatBinary = windll.GetProcAddress(handle, 'cuModuleLoadFatBinary') {{endif}} {{if 'cuModuleUnload' in found_functions}} - try: - global __cuModuleUnload - __cuModuleUnload = win32api.GetProcAddress(handle, 'cuModuleUnload') - except: - pass + global __cuModuleUnload + __cuModuleUnload = windll.GetProcAddress(handle, 'cuModuleUnload') {{endif}} {{if 'cuModuleGetLoadingMode' in found_functions}} - try: - global __cuModuleGetLoadingMode - __cuModuleGetLoadingMode = win32api.GetProcAddress(handle, 'cuModuleGetLoadingMode') - except: - pass + global __cuModuleGetLoadingMode + __cuModuleGetLoadingMode = windll.GetProcAddress(handle, 'cuModuleGetLoadingMode') {{endif}} {{if 'cuModuleGetFunction' in found_functions}} - try: - global __cuModuleGetFunction - __cuModuleGetFunction = win32api.GetProcAddress(handle, 'cuModuleGetFunction') - except: - pass + global __cuModuleGetFunction + __cuModuleGetFunction = windll.GetProcAddress(handle, 'cuModuleGetFunction') {{endif}} {{if 'cuModuleGetFunctionCount' in found_functions}} - try: - global __cuModuleGetFunctionCount - __cuModuleGetFunctionCount = win32api.GetProcAddress(handle, 'cuModuleGetFunctionCount') - except: - pass + global __cuModuleGetFunctionCount + __cuModuleGetFunctionCount = windll.GetProcAddress(handle, 'cuModuleGetFunctionCount') {{endif}} {{if 'cuModuleEnumerateFunctions' in found_functions}} - try: - global __cuModuleEnumerateFunctions - __cuModuleEnumerateFunctions = win32api.GetProcAddress(handle, 'cuModuleEnumerateFunctions') - except: - pass + global __cuModuleEnumerateFunctions + __cuModuleEnumerateFunctions = windll.GetProcAddress(handle, 'cuModuleEnumerateFunctions') {{endif}} {{if 'cuModuleGetGlobal_v2' in found_functions}} - try: - global __cuModuleGetGlobal_v2 - __cuModuleGetGlobal_v2 = win32api.GetProcAddress(handle, 'cuModuleGetGlobal_v2') - except: - pass + global __cuModuleGetGlobal_v2 + __cuModuleGetGlobal_v2 = windll.GetProcAddress(handle, 'cuModuleGetGlobal_v2') {{endif}} {{if 'cuLinkCreate_v2' in found_functions}} - try: - global __cuLinkCreate_v2 - __cuLinkCreate_v2 = win32api.GetProcAddress(handle, 'cuLinkCreate_v2') - except: - pass + global __cuLinkCreate_v2 + __cuLinkCreate_v2 = windll.GetProcAddress(handle, 'cuLinkCreate_v2') {{endif}} {{if 'cuLinkAddData_v2' in found_functions}} - try: - global __cuLinkAddData_v2 - __cuLinkAddData_v2 = win32api.GetProcAddress(handle, 'cuLinkAddData_v2') - except: - pass + global __cuLinkAddData_v2 + __cuLinkAddData_v2 = windll.GetProcAddress(handle, 'cuLinkAddData_v2') {{endif}} {{if 'cuLinkAddFile_v2' in found_functions}} - try: - global __cuLinkAddFile_v2 - __cuLinkAddFile_v2 = win32api.GetProcAddress(handle, 'cuLinkAddFile_v2') - except: - pass + global __cuLinkAddFile_v2 + __cuLinkAddFile_v2 = windll.GetProcAddress(handle, 'cuLinkAddFile_v2') {{endif}} {{if 'cuLinkComplete' in found_functions}} - try: - global __cuLinkComplete - __cuLinkComplete = win32api.GetProcAddress(handle, 'cuLinkComplete') - except: - pass + global __cuLinkComplete + __cuLinkComplete = windll.GetProcAddress(handle, 'cuLinkComplete') {{endif}} {{if 'cuLinkDestroy' in found_functions}} - try: - global __cuLinkDestroy - __cuLinkDestroy = win32api.GetProcAddress(handle, 'cuLinkDestroy') - except: - pass + global __cuLinkDestroy + __cuLinkDestroy = windll.GetProcAddress(handle, 'cuLinkDestroy') {{endif}} {{if 'cuModuleGetTexRef' in found_functions}} - try: - global __cuModuleGetTexRef - __cuModuleGetTexRef = win32api.GetProcAddress(handle, 'cuModuleGetTexRef') - except: - pass + global __cuModuleGetTexRef + __cuModuleGetTexRef = windll.GetProcAddress(handle, 'cuModuleGetTexRef') {{endif}} {{if 'cuModuleGetSurfRef' in found_functions}} - try: - global __cuModuleGetSurfRef - __cuModuleGetSurfRef = win32api.GetProcAddress(handle, 'cuModuleGetSurfRef') - except: - pass + global __cuModuleGetSurfRef + __cuModuleGetSurfRef = windll.GetProcAddress(handle, 'cuModuleGetSurfRef') {{endif}} {{if 'cuLibraryLoadData' in found_functions}} - try: - global __cuLibraryLoadData - __cuLibraryLoadData = win32api.GetProcAddress(handle, 'cuLibraryLoadData') - except: - pass + global __cuLibraryLoadData + __cuLibraryLoadData = windll.GetProcAddress(handle, 'cuLibraryLoadData') {{endif}} {{if 'cuLibraryLoadFromFile' in found_functions}} - try: - global __cuLibraryLoadFromFile - __cuLibraryLoadFromFile = win32api.GetProcAddress(handle, 'cuLibraryLoadFromFile') - except: - pass + global __cuLibraryLoadFromFile + __cuLibraryLoadFromFile = windll.GetProcAddress(handle, 'cuLibraryLoadFromFile') {{endif}} {{if 'cuLibraryUnload' in found_functions}} - try: - global __cuLibraryUnload - __cuLibraryUnload = win32api.GetProcAddress(handle, 'cuLibraryUnload') - except: - pass + global __cuLibraryUnload + __cuLibraryUnload = windll.GetProcAddress(handle, 'cuLibraryUnload') {{endif}} {{if 'cuLibraryGetKernel' in found_functions}} - try: - global __cuLibraryGetKernel - __cuLibraryGetKernel = win32api.GetProcAddress(handle, 'cuLibraryGetKernel') - except: - pass + global __cuLibraryGetKernel + __cuLibraryGetKernel = windll.GetProcAddress(handle, 'cuLibraryGetKernel') {{endif}} {{if 'cuLibraryGetKernelCount' in found_functions}} - try: - global __cuLibraryGetKernelCount - __cuLibraryGetKernelCount = win32api.GetProcAddress(handle, 'cuLibraryGetKernelCount') - except: - pass + global __cuLibraryGetKernelCount + __cuLibraryGetKernelCount = windll.GetProcAddress(handle, 'cuLibraryGetKernelCount') {{endif}} {{if 'cuLibraryEnumerateKernels' in found_functions}} - try: - global __cuLibraryEnumerateKernels - __cuLibraryEnumerateKernels = win32api.GetProcAddress(handle, 'cuLibraryEnumerateKernels') - except: - pass + global __cuLibraryEnumerateKernels + __cuLibraryEnumerateKernels = windll.GetProcAddress(handle, 'cuLibraryEnumerateKernels') {{endif}} {{if 'cuLibraryGetModule' in found_functions}} - try: - global __cuLibraryGetModule - __cuLibraryGetModule = win32api.GetProcAddress(handle, 'cuLibraryGetModule') - except: - pass + global __cuLibraryGetModule + __cuLibraryGetModule = windll.GetProcAddress(handle, 'cuLibraryGetModule') {{endif}} {{if 'cuKernelGetFunction' in found_functions}} - try: - global __cuKernelGetFunction - __cuKernelGetFunction = win32api.GetProcAddress(handle, 'cuKernelGetFunction') - except: - pass + global __cuKernelGetFunction + __cuKernelGetFunction = windll.GetProcAddress(handle, 'cuKernelGetFunction') {{endif}} {{if 'cuKernelGetLibrary' in found_functions}} - try: - global __cuKernelGetLibrary - __cuKernelGetLibrary = win32api.GetProcAddress(handle, 'cuKernelGetLibrary') - except: - pass + global __cuKernelGetLibrary + __cuKernelGetLibrary = windll.GetProcAddress(handle, 'cuKernelGetLibrary') {{endif}} {{if 'cuLibraryGetGlobal' in found_functions}} - try: - global __cuLibraryGetGlobal - __cuLibraryGetGlobal = win32api.GetProcAddress(handle, 'cuLibraryGetGlobal') - except: - pass + global __cuLibraryGetGlobal + __cuLibraryGetGlobal = windll.GetProcAddress(handle, 'cuLibraryGetGlobal') {{endif}} {{if 'cuLibraryGetManaged' in found_functions}} - try: - global __cuLibraryGetManaged - __cuLibraryGetManaged = win32api.GetProcAddress(handle, 'cuLibraryGetManaged') - except: - pass + global __cuLibraryGetManaged + __cuLibraryGetManaged = windll.GetProcAddress(handle, 'cuLibraryGetManaged') {{endif}} {{if 'cuLibraryGetUnifiedFunction' in found_functions}} - try: - global __cuLibraryGetUnifiedFunction - __cuLibraryGetUnifiedFunction = win32api.GetProcAddress(handle, 'cuLibraryGetUnifiedFunction') - except: - pass + global __cuLibraryGetUnifiedFunction + __cuLibraryGetUnifiedFunction = windll.GetProcAddress(handle, 'cuLibraryGetUnifiedFunction') {{endif}} {{if 'cuKernelGetAttribute' in found_functions}} - try: - global __cuKernelGetAttribute - __cuKernelGetAttribute = win32api.GetProcAddress(handle, 'cuKernelGetAttribute') - except: - pass + global __cuKernelGetAttribute + __cuKernelGetAttribute = windll.GetProcAddress(handle, 'cuKernelGetAttribute') {{endif}} {{if 'cuKernelSetAttribute' in found_functions}} - try: - global __cuKernelSetAttribute - __cuKernelSetAttribute = win32api.GetProcAddress(handle, 'cuKernelSetAttribute') - except: - pass + global __cuKernelSetAttribute + __cuKernelSetAttribute = windll.GetProcAddress(handle, 'cuKernelSetAttribute') {{endif}} {{if 'cuKernelSetCacheConfig' in found_functions}} - try: - global __cuKernelSetCacheConfig - __cuKernelSetCacheConfig = win32api.GetProcAddress(handle, 'cuKernelSetCacheConfig') - except: - pass + global __cuKernelSetCacheConfig + __cuKernelSetCacheConfig = windll.GetProcAddress(handle, 'cuKernelSetCacheConfig') {{endif}} {{if 'cuKernelGetName' in found_functions}} - try: - global __cuKernelGetName - __cuKernelGetName = win32api.GetProcAddress(handle, 'cuKernelGetName') - except: - pass + global __cuKernelGetName + __cuKernelGetName = windll.GetProcAddress(handle, 'cuKernelGetName') {{endif}} {{if 'cuKernelGetParamInfo' in found_functions}} - try: - global __cuKernelGetParamInfo - __cuKernelGetParamInfo = win32api.GetProcAddress(handle, 'cuKernelGetParamInfo') - except: - pass + global __cuKernelGetParamInfo + __cuKernelGetParamInfo = windll.GetProcAddress(handle, 'cuKernelGetParamInfo') {{endif}} {{if 'cuMemGetInfo_v2' in found_functions}} - try: - global __cuMemGetInfo_v2 - __cuMemGetInfo_v2 = win32api.GetProcAddress(handle, 'cuMemGetInfo_v2') - except: - pass + global __cuMemGetInfo_v2 + __cuMemGetInfo_v2 = windll.GetProcAddress(handle, 'cuMemGetInfo_v2') {{endif}} {{if 'cuMemAlloc_v2' in found_functions}} - try: - global __cuMemAlloc_v2 - __cuMemAlloc_v2 = win32api.GetProcAddress(handle, 'cuMemAlloc_v2') - except: - pass + global __cuMemAlloc_v2 + __cuMemAlloc_v2 = windll.GetProcAddress(handle, 'cuMemAlloc_v2') {{endif}} {{if 'cuMemAllocPitch_v2' in found_functions}} - try: - global __cuMemAllocPitch_v2 - __cuMemAllocPitch_v2 = win32api.GetProcAddress(handle, 'cuMemAllocPitch_v2') - except: - pass + global __cuMemAllocPitch_v2 + __cuMemAllocPitch_v2 = windll.GetProcAddress(handle, 'cuMemAllocPitch_v2') {{endif}} {{if 'cuMemFree_v2' in found_functions}} - try: - global __cuMemFree_v2 - __cuMemFree_v2 = win32api.GetProcAddress(handle, 'cuMemFree_v2') - except: - pass + global __cuMemFree_v2 + __cuMemFree_v2 = windll.GetProcAddress(handle, 'cuMemFree_v2') {{endif}} {{if 'cuMemGetAddressRange_v2' in found_functions}} - try: - global __cuMemGetAddressRange_v2 - __cuMemGetAddressRange_v2 = win32api.GetProcAddress(handle, 'cuMemGetAddressRange_v2') - except: - pass + global __cuMemGetAddressRange_v2 + __cuMemGetAddressRange_v2 = windll.GetProcAddress(handle, 'cuMemGetAddressRange_v2') {{endif}} {{if 'cuMemAllocHost_v2' in found_functions}} - try: - global __cuMemAllocHost_v2 - __cuMemAllocHost_v2 = win32api.GetProcAddress(handle, 'cuMemAllocHost_v2') - except: - pass + global __cuMemAllocHost_v2 + __cuMemAllocHost_v2 = windll.GetProcAddress(handle, 'cuMemAllocHost_v2') {{endif}} {{if 'cuMemFreeHost' in found_functions}} - try: - global __cuMemFreeHost - __cuMemFreeHost = win32api.GetProcAddress(handle, 'cuMemFreeHost') - except: - pass + global __cuMemFreeHost + __cuMemFreeHost = windll.GetProcAddress(handle, 'cuMemFreeHost') {{endif}} {{if 'cuMemHostAlloc' in found_functions}} - try: - global __cuMemHostAlloc - __cuMemHostAlloc = win32api.GetProcAddress(handle, 'cuMemHostAlloc') - except: - pass + global __cuMemHostAlloc + __cuMemHostAlloc = windll.GetProcAddress(handle, 'cuMemHostAlloc') {{endif}} {{if 'cuMemHostGetDevicePointer_v2' in found_functions}} - try: - global __cuMemHostGetDevicePointer_v2 - __cuMemHostGetDevicePointer_v2 = win32api.GetProcAddress(handle, 'cuMemHostGetDevicePointer_v2') - except: - pass + global __cuMemHostGetDevicePointer_v2 + __cuMemHostGetDevicePointer_v2 = windll.GetProcAddress(handle, 'cuMemHostGetDevicePointer_v2') {{endif}} {{if 'cuMemHostGetFlags' in found_functions}} - try: - global __cuMemHostGetFlags - __cuMemHostGetFlags = win32api.GetProcAddress(handle, 'cuMemHostGetFlags') - except: - pass + global __cuMemHostGetFlags + __cuMemHostGetFlags = windll.GetProcAddress(handle, 'cuMemHostGetFlags') {{endif}} {{if 'cuMemAllocManaged' in found_functions}} - try: - global __cuMemAllocManaged - __cuMemAllocManaged = win32api.GetProcAddress(handle, 'cuMemAllocManaged') - except: - pass + global __cuMemAllocManaged + __cuMemAllocManaged = windll.GetProcAddress(handle, 'cuMemAllocManaged') {{endif}} {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - try: - global __cuDeviceRegisterAsyncNotification - __cuDeviceRegisterAsyncNotification = win32api.GetProcAddress(handle, 'cuDeviceRegisterAsyncNotification') - except: - pass + global __cuDeviceRegisterAsyncNotification + __cuDeviceRegisterAsyncNotification = windll.GetProcAddress(handle, 'cuDeviceRegisterAsyncNotification') {{endif}} {{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} - try: - global __cuDeviceUnregisterAsyncNotification - __cuDeviceUnregisterAsyncNotification = win32api.GetProcAddress(handle, 'cuDeviceUnregisterAsyncNotification') - except: - pass + global __cuDeviceUnregisterAsyncNotification + __cuDeviceUnregisterAsyncNotification = windll.GetProcAddress(handle, 'cuDeviceUnregisterAsyncNotification') {{endif}} {{if 'cuDeviceGetByPCIBusId' in found_functions}} - try: - global __cuDeviceGetByPCIBusId - __cuDeviceGetByPCIBusId = win32api.GetProcAddress(handle, 'cuDeviceGetByPCIBusId') - except: - pass + global __cuDeviceGetByPCIBusId + __cuDeviceGetByPCIBusId = windll.GetProcAddress(handle, 'cuDeviceGetByPCIBusId') {{endif}} {{if 'cuDeviceGetPCIBusId' in found_functions}} - try: - global __cuDeviceGetPCIBusId - __cuDeviceGetPCIBusId = win32api.GetProcAddress(handle, 'cuDeviceGetPCIBusId') - except: - pass + global __cuDeviceGetPCIBusId + __cuDeviceGetPCIBusId = windll.GetProcAddress(handle, 'cuDeviceGetPCIBusId') {{endif}} {{if 'cuIpcGetEventHandle' in found_functions}} - try: - global __cuIpcGetEventHandle - __cuIpcGetEventHandle = win32api.GetProcAddress(handle, 'cuIpcGetEventHandle') - except: - pass + global __cuIpcGetEventHandle + __cuIpcGetEventHandle = windll.GetProcAddress(handle, 'cuIpcGetEventHandle') {{endif}} {{if 'cuIpcOpenEventHandle' in found_functions}} - try: - global __cuIpcOpenEventHandle - __cuIpcOpenEventHandle = win32api.GetProcAddress(handle, 'cuIpcOpenEventHandle') - except: - pass + global __cuIpcOpenEventHandle + __cuIpcOpenEventHandle = windll.GetProcAddress(handle, 'cuIpcOpenEventHandle') {{endif}} {{if 'cuIpcGetMemHandle' in found_functions}} - try: - global __cuIpcGetMemHandle - __cuIpcGetMemHandle = win32api.GetProcAddress(handle, 'cuIpcGetMemHandle') - except: - pass + global __cuIpcGetMemHandle + __cuIpcGetMemHandle = windll.GetProcAddress(handle, 'cuIpcGetMemHandle') {{endif}} {{if 'cuIpcOpenMemHandle_v2' in found_functions}} - try: - global __cuIpcOpenMemHandle_v2 - __cuIpcOpenMemHandle_v2 = win32api.GetProcAddress(handle, 'cuIpcOpenMemHandle_v2') - except: - pass + global __cuIpcOpenMemHandle_v2 + __cuIpcOpenMemHandle_v2 = windll.GetProcAddress(handle, 'cuIpcOpenMemHandle_v2') {{endif}} {{if 'cuIpcCloseMemHandle' in found_functions}} - try: - global __cuIpcCloseMemHandle - __cuIpcCloseMemHandle = win32api.GetProcAddress(handle, 'cuIpcCloseMemHandle') - except: - pass + global __cuIpcCloseMemHandle + __cuIpcCloseMemHandle = windll.GetProcAddress(handle, 'cuIpcCloseMemHandle') {{endif}} {{if 'cuMemHostRegister_v2' in found_functions}} - try: - global __cuMemHostRegister_v2 - __cuMemHostRegister_v2 = win32api.GetProcAddress(handle, 'cuMemHostRegister_v2') - except: - pass + global __cuMemHostRegister_v2 + __cuMemHostRegister_v2 = windll.GetProcAddress(handle, 'cuMemHostRegister_v2') {{endif}} {{if 'cuMemHostUnregister' in found_functions}} - try: - global __cuMemHostUnregister - __cuMemHostUnregister = win32api.GetProcAddress(handle, 'cuMemHostUnregister') - except: - pass + global __cuMemHostUnregister + __cuMemHostUnregister = windll.GetProcAddress(handle, 'cuMemHostUnregister') {{endif}} {{if 'cuArrayCreate_v2' in found_functions}} - try: - global __cuArrayCreate_v2 - __cuArrayCreate_v2 = win32api.GetProcAddress(handle, 'cuArrayCreate_v2') - except: - pass + global __cuArrayCreate_v2 + __cuArrayCreate_v2 = windll.GetProcAddress(handle, 'cuArrayCreate_v2') {{endif}} {{if 'cuArrayGetDescriptor_v2' in found_functions}} - try: - global __cuArrayGetDescriptor_v2 - __cuArrayGetDescriptor_v2 = win32api.GetProcAddress(handle, 'cuArrayGetDescriptor_v2') - except: - pass + global __cuArrayGetDescriptor_v2 + __cuArrayGetDescriptor_v2 = windll.GetProcAddress(handle, 'cuArrayGetDescriptor_v2') {{endif}} {{if 'cuArrayGetSparseProperties' in found_functions}} - try: - global __cuArrayGetSparseProperties - __cuArrayGetSparseProperties = win32api.GetProcAddress(handle, 'cuArrayGetSparseProperties') - except: - pass + global __cuArrayGetSparseProperties + __cuArrayGetSparseProperties = windll.GetProcAddress(handle, 'cuArrayGetSparseProperties') {{endif}} {{if 'cuMipmappedArrayGetSparseProperties' in found_functions}} - try: - global __cuMipmappedArrayGetSparseProperties - __cuMipmappedArrayGetSparseProperties = win32api.GetProcAddress(handle, 'cuMipmappedArrayGetSparseProperties') - except: - pass + global __cuMipmappedArrayGetSparseProperties + __cuMipmappedArrayGetSparseProperties = windll.GetProcAddress(handle, 'cuMipmappedArrayGetSparseProperties') {{endif}} {{if 'cuArrayGetMemoryRequirements' in found_functions}} - try: - global __cuArrayGetMemoryRequirements - __cuArrayGetMemoryRequirements = win32api.GetProcAddress(handle, 'cuArrayGetMemoryRequirements') - except: - pass + global __cuArrayGetMemoryRequirements + __cuArrayGetMemoryRequirements = windll.GetProcAddress(handle, 'cuArrayGetMemoryRequirements') {{endif}} {{if 'cuMipmappedArrayGetMemoryRequirements' in found_functions}} - try: - global __cuMipmappedArrayGetMemoryRequirements - __cuMipmappedArrayGetMemoryRequirements = win32api.GetProcAddress(handle, 'cuMipmappedArrayGetMemoryRequirements') - except: - pass + global __cuMipmappedArrayGetMemoryRequirements + __cuMipmappedArrayGetMemoryRequirements = windll.GetProcAddress(handle, 'cuMipmappedArrayGetMemoryRequirements') {{endif}} {{if 'cuArrayGetPlane' in found_functions}} - try: - global __cuArrayGetPlane - __cuArrayGetPlane = win32api.GetProcAddress(handle, 'cuArrayGetPlane') - except: - pass + global __cuArrayGetPlane + __cuArrayGetPlane = windll.GetProcAddress(handle, 'cuArrayGetPlane') {{endif}} {{if 'cuArrayDestroy' in found_functions}} - try: - global __cuArrayDestroy - __cuArrayDestroy = win32api.GetProcAddress(handle, 'cuArrayDestroy') - except: - pass + global __cuArrayDestroy + __cuArrayDestroy = windll.GetProcAddress(handle, 'cuArrayDestroy') {{endif}} {{if 'cuArray3DCreate_v2' in found_functions}} - try: - global __cuArray3DCreate_v2 - __cuArray3DCreate_v2 = win32api.GetProcAddress(handle, 'cuArray3DCreate_v2') - except: - pass + global __cuArray3DCreate_v2 + __cuArray3DCreate_v2 = windll.GetProcAddress(handle, 'cuArray3DCreate_v2') {{endif}} {{if 'cuArray3DGetDescriptor_v2' in found_functions}} - try: - global __cuArray3DGetDescriptor_v2 - __cuArray3DGetDescriptor_v2 = win32api.GetProcAddress(handle, 'cuArray3DGetDescriptor_v2') - except: - pass + global __cuArray3DGetDescriptor_v2 + __cuArray3DGetDescriptor_v2 = windll.GetProcAddress(handle, 'cuArray3DGetDescriptor_v2') {{endif}} {{if 'cuMipmappedArrayCreate' in found_functions}} - try: - global __cuMipmappedArrayCreate - __cuMipmappedArrayCreate = win32api.GetProcAddress(handle, 'cuMipmappedArrayCreate') - except: - pass + global __cuMipmappedArrayCreate + __cuMipmappedArrayCreate = windll.GetProcAddress(handle, 'cuMipmappedArrayCreate') {{endif}} {{if 'cuMipmappedArrayGetLevel' in found_functions}} - try: - global __cuMipmappedArrayGetLevel - __cuMipmappedArrayGetLevel = win32api.GetProcAddress(handle, 'cuMipmappedArrayGetLevel') - except: - pass + global __cuMipmappedArrayGetLevel + __cuMipmappedArrayGetLevel = windll.GetProcAddress(handle, 'cuMipmappedArrayGetLevel') {{endif}} {{if 'cuMipmappedArrayDestroy' in found_functions}} - try: - global __cuMipmappedArrayDestroy - __cuMipmappedArrayDestroy = win32api.GetProcAddress(handle, 'cuMipmappedArrayDestroy') - except: - pass + global __cuMipmappedArrayDestroy + __cuMipmappedArrayDestroy = windll.GetProcAddress(handle, 'cuMipmappedArrayDestroy') {{endif}} {{if 'cuMemGetHandleForAddressRange' in found_functions}} - try: - global __cuMemGetHandleForAddressRange - __cuMemGetHandleForAddressRange = win32api.GetProcAddress(handle, 'cuMemGetHandleForAddressRange') - except: - pass + global __cuMemGetHandleForAddressRange + __cuMemGetHandleForAddressRange = windll.GetProcAddress(handle, 'cuMemGetHandleForAddressRange') {{endif}} {{if 'cuMemAddressReserve' in found_functions}} - try: - global __cuMemAddressReserve - __cuMemAddressReserve = win32api.GetProcAddress(handle, 'cuMemAddressReserve') - except: - pass + global __cuMemAddressReserve + __cuMemAddressReserve = windll.GetProcAddress(handle, 'cuMemAddressReserve') {{endif}} {{if 'cuMemAddressFree' in found_functions}} - try: - global __cuMemAddressFree - __cuMemAddressFree = win32api.GetProcAddress(handle, 'cuMemAddressFree') - except: - pass + global __cuMemAddressFree + __cuMemAddressFree = windll.GetProcAddress(handle, 'cuMemAddressFree') {{endif}} {{if 'cuMemCreate' in found_functions}} - try: - global __cuMemCreate - __cuMemCreate = win32api.GetProcAddress(handle, 'cuMemCreate') - except: - pass + global __cuMemCreate + __cuMemCreate = windll.GetProcAddress(handle, 'cuMemCreate') {{endif}} {{if 'cuMemRelease' in found_functions}} - try: - global __cuMemRelease - __cuMemRelease = win32api.GetProcAddress(handle, 'cuMemRelease') - except: - pass + global __cuMemRelease + __cuMemRelease = windll.GetProcAddress(handle, 'cuMemRelease') {{endif}} {{if 'cuMemMap' in found_functions}} - try: - global __cuMemMap - __cuMemMap = win32api.GetProcAddress(handle, 'cuMemMap') - except: - pass + global __cuMemMap + __cuMemMap = windll.GetProcAddress(handle, 'cuMemMap') {{endif}} {{if 'cuMemUnmap' in found_functions}} - try: - global __cuMemUnmap - __cuMemUnmap = win32api.GetProcAddress(handle, 'cuMemUnmap') - except: - pass + global __cuMemUnmap + __cuMemUnmap = windll.GetProcAddress(handle, 'cuMemUnmap') {{endif}} {{if 'cuMemSetAccess' in found_functions}} - try: - global __cuMemSetAccess - __cuMemSetAccess = win32api.GetProcAddress(handle, 'cuMemSetAccess') - except: - pass + global __cuMemSetAccess + __cuMemSetAccess = windll.GetProcAddress(handle, 'cuMemSetAccess') {{endif}} {{if 'cuMemGetAccess' in found_functions}} - try: - global __cuMemGetAccess - __cuMemGetAccess = win32api.GetProcAddress(handle, 'cuMemGetAccess') - except: - pass + global __cuMemGetAccess + __cuMemGetAccess = windll.GetProcAddress(handle, 'cuMemGetAccess') {{endif}} {{if 'cuMemExportToShareableHandle' in found_functions}} - try: - global __cuMemExportToShareableHandle - __cuMemExportToShareableHandle = win32api.GetProcAddress(handle, 'cuMemExportToShareableHandle') - except: - pass + global __cuMemExportToShareableHandle + __cuMemExportToShareableHandle = windll.GetProcAddress(handle, 'cuMemExportToShareableHandle') {{endif}} {{if 'cuMemImportFromShareableHandle' in found_functions}} - try: - global __cuMemImportFromShareableHandle - __cuMemImportFromShareableHandle = win32api.GetProcAddress(handle, 'cuMemImportFromShareableHandle') - except: - pass + global __cuMemImportFromShareableHandle + __cuMemImportFromShareableHandle = windll.GetProcAddress(handle, 'cuMemImportFromShareableHandle') {{endif}} {{if 'cuMemGetAllocationGranularity' in found_functions}} - try: - global __cuMemGetAllocationGranularity - __cuMemGetAllocationGranularity = win32api.GetProcAddress(handle, 'cuMemGetAllocationGranularity') - except: - pass + global __cuMemGetAllocationGranularity + __cuMemGetAllocationGranularity = windll.GetProcAddress(handle, 'cuMemGetAllocationGranularity') {{endif}} {{if 'cuMemGetAllocationPropertiesFromHandle' in found_functions}} - try: - global __cuMemGetAllocationPropertiesFromHandle - __cuMemGetAllocationPropertiesFromHandle = win32api.GetProcAddress(handle, 'cuMemGetAllocationPropertiesFromHandle') - except: - pass + global __cuMemGetAllocationPropertiesFromHandle + __cuMemGetAllocationPropertiesFromHandle = windll.GetProcAddress(handle, 'cuMemGetAllocationPropertiesFromHandle') {{endif}} {{if 'cuMemRetainAllocationHandle' in found_functions}} - try: - global __cuMemRetainAllocationHandle - __cuMemRetainAllocationHandle = win32api.GetProcAddress(handle, 'cuMemRetainAllocationHandle') - except: - pass + global __cuMemRetainAllocationHandle + __cuMemRetainAllocationHandle = windll.GetProcAddress(handle, 'cuMemRetainAllocationHandle') {{endif}} {{if 'cuMemPoolTrimTo' in found_functions}} - try: - global __cuMemPoolTrimTo - __cuMemPoolTrimTo = win32api.GetProcAddress(handle, 'cuMemPoolTrimTo') - except: - pass + global __cuMemPoolTrimTo + __cuMemPoolTrimTo = windll.GetProcAddress(handle, 'cuMemPoolTrimTo') {{endif}} {{if 'cuMemPoolSetAttribute' in found_functions}} - try: - global __cuMemPoolSetAttribute - __cuMemPoolSetAttribute = win32api.GetProcAddress(handle, 'cuMemPoolSetAttribute') - except: - pass + global __cuMemPoolSetAttribute + __cuMemPoolSetAttribute = windll.GetProcAddress(handle, 'cuMemPoolSetAttribute') {{endif}} {{if 'cuMemPoolGetAttribute' in found_functions}} - try: - global __cuMemPoolGetAttribute - __cuMemPoolGetAttribute = win32api.GetProcAddress(handle, 'cuMemPoolGetAttribute') - except: - pass + global __cuMemPoolGetAttribute + __cuMemPoolGetAttribute = windll.GetProcAddress(handle, 'cuMemPoolGetAttribute') {{endif}} {{if 'cuMemPoolSetAccess' in found_functions}} - try: - global __cuMemPoolSetAccess - __cuMemPoolSetAccess = win32api.GetProcAddress(handle, 'cuMemPoolSetAccess') - except: - pass + global __cuMemPoolSetAccess + __cuMemPoolSetAccess = windll.GetProcAddress(handle, 'cuMemPoolSetAccess') {{endif}} {{if 'cuMemPoolGetAccess' in found_functions}} - try: - global __cuMemPoolGetAccess - __cuMemPoolGetAccess = win32api.GetProcAddress(handle, 'cuMemPoolGetAccess') - except: - pass + global __cuMemPoolGetAccess + __cuMemPoolGetAccess = windll.GetProcAddress(handle, 'cuMemPoolGetAccess') {{endif}} {{if 'cuMemPoolCreate' in found_functions}} - try: - global __cuMemPoolCreate - __cuMemPoolCreate = win32api.GetProcAddress(handle, 'cuMemPoolCreate') - except: - pass + global __cuMemPoolCreate + __cuMemPoolCreate = windll.GetProcAddress(handle, 'cuMemPoolCreate') {{endif}} {{if 'cuMemPoolDestroy' in found_functions}} - try: - global __cuMemPoolDestroy - __cuMemPoolDestroy = win32api.GetProcAddress(handle, 'cuMemPoolDestroy') - except: - pass + global __cuMemPoolDestroy + __cuMemPoolDestroy = windll.GetProcAddress(handle, 'cuMemPoolDestroy') {{endif}} {{if 'cuMemGetDefaultMemPool' in found_functions}} - try: - global __cuMemGetDefaultMemPool - __cuMemGetDefaultMemPool = win32api.GetProcAddress(handle, 'cuMemGetDefaultMemPool') - except: - pass + global __cuMemGetDefaultMemPool + __cuMemGetDefaultMemPool = windll.GetProcAddress(handle, 'cuMemGetDefaultMemPool') {{endif}} {{if 'cuMemGetMemPool' in found_functions}} - try: - global __cuMemGetMemPool - __cuMemGetMemPool = win32api.GetProcAddress(handle, 'cuMemGetMemPool') - except: - pass + global __cuMemGetMemPool + __cuMemGetMemPool = windll.GetProcAddress(handle, 'cuMemGetMemPool') {{endif}} {{if 'cuMemSetMemPool' in found_functions}} - try: - global __cuMemSetMemPool - __cuMemSetMemPool = win32api.GetProcAddress(handle, 'cuMemSetMemPool') - except: - pass + global __cuMemSetMemPool + __cuMemSetMemPool = windll.GetProcAddress(handle, 'cuMemSetMemPool') {{endif}} {{if 'cuMemPoolExportToShareableHandle' in found_functions}} - try: - global __cuMemPoolExportToShareableHandle - __cuMemPoolExportToShareableHandle = win32api.GetProcAddress(handle, 'cuMemPoolExportToShareableHandle') - except: - pass + global __cuMemPoolExportToShareableHandle + __cuMemPoolExportToShareableHandle = windll.GetProcAddress(handle, 'cuMemPoolExportToShareableHandle') {{endif}} {{if 'cuMemPoolImportFromShareableHandle' in found_functions}} - try: - global __cuMemPoolImportFromShareableHandle - __cuMemPoolImportFromShareableHandle = win32api.GetProcAddress(handle, 'cuMemPoolImportFromShareableHandle') - except: - pass + global __cuMemPoolImportFromShareableHandle + __cuMemPoolImportFromShareableHandle = windll.GetProcAddress(handle, 'cuMemPoolImportFromShareableHandle') {{endif}} {{if 'cuMemPoolExportPointer' in found_functions}} - try: - global __cuMemPoolExportPointer - __cuMemPoolExportPointer = win32api.GetProcAddress(handle, 'cuMemPoolExportPointer') - except: - pass + global __cuMemPoolExportPointer + __cuMemPoolExportPointer = windll.GetProcAddress(handle, 'cuMemPoolExportPointer') {{endif}} {{if 'cuMemPoolImportPointer' in found_functions}} - try: - global __cuMemPoolImportPointer - __cuMemPoolImportPointer = win32api.GetProcAddress(handle, 'cuMemPoolImportPointer') - except: - pass + global __cuMemPoolImportPointer + __cuMemPoolImportPointer = windll.GetProcAddress(handle, 'cuMemPoolImportPointer') {{endif}} {{if 'cuMulticastCreate' in found_functions}} - try: - global __cuMulticastCreate - __cuMulticastCreate = win32api.GetProcAddress(handle, 'cuMulticastCreate') - except: - pass + global __cuMulticastCreate + __cuMulticastCreate = windll.GetProcAddress(handle, 'cuMulticastCreate') {{endif}} {{if 'cuMulticastAddDevice' in found_functions}} - try: - global __cuMulticastAddDevice - __cuMulticastAddDevice = win32api.GetProcAddress(handle, 'cuMulticastAddDevice') - except: - pass + global __cuMulticastAddDevice + __cuMulticastAddDevice = windll.GetProcAddress(handle, 'cuMulticastAddDevice') {{endif}} {{if 'cuMulticastBindMem' in found_functions}} - try: - global __cuMulticastBindMem - __cuMulticastBindMem = win32api.GetProcAddress(handle, 'cuMulticastBindMem') - except: - pass + global __cuMulticastBindMem + __cuMulticastBindMem = windll.GetProcAddress(handle, 'cuMulticastBindMem') {{endif}} {{if 'cuMulticastBindAddr' in found_functions}} - try: - global __cuMulticastBindAddr - __cuMulticastBindAddr = win32api.GetProcAddress(handle, 'cuMulticastBindAddr') - except: - pass + global __cuMulticastBindAddr + __cuMulticastBindAddr = windll.GetProcAddress(handle, 'cuMulticastBindAddr') {{endif}} {{if 'cuMulticastUnbind' in found_functions}} - try: - global __cuMulticastUnbind - __cuMulticastUnbind = win32api.GetProcAddress(handle, 'cuMulticastUnbind') - except: - pass + global __cuMulticastUnbind + __cuMulticastUnbind = windll.GetProcAddress(handle, 'cuMulticastUnbind') {{endif}} {{if 'cuMulticastGetGranularity' in found_functions}} - try: - global __cuMulticastGetGranularity - __cuMulticastGetGranularity = win32api.GetProcAddress(handle, 'cuMulticastGetGranularity') - except: - pass + global __cuMulticastGetGranularity + __cuMulticastGetGranularity = windll.GetProcAddress(handle, 'cuMulticastGetGranularity') {{endif}} {{if 'cuPointerGetAttribute' in found_functions}} - try: - global __cuPointerGetAttribute - __cuPointerGetAttribute = win32api.GetProcAddress(handle, 'cuPointerGetAttribute') - except: - pass + global __cuPointerGetAttribute + __cuPointerGetAttribute = windll.GetProcAddress(handle, 'cuPointerGetAttribute') {{endif}} {{if 'cuMemAdvise_v2' in found_functions}} - try: - global __cuMemAdvise_v2 - __cuMemAdvise_v2 = win32api.GetProcAddress(handle, 'cuMemAdvise_v2') - except: - pass + global __cuMemAdvise_v2 + __cuMemAdvise_v2 = windll.GetProcAddress(handle, 'cuMemAdvise_v2') {{endif}} {{if 'cuMemRangeGetAttribute' in found_functions}} - try: - global __cuMemRangeGetAttribute - __cuMemRangeGetAttribute = win32api.GetProcAddress(handle, 'cuMemRangeGetAttribute') - except: - pass + global __cuMemRangeGetAttribute + __cuMemRangeGetAttribute = windll.GetProcAddress(handle, 'cuMemRangeGetAttribute') {{endif}} {{if 'cuMemRangeGetAttributes' in found_functions}} - try: - global __cuMemRangeGetAttributes - __cuMemRangeGetAttributes = win32api.GetProcAddress(handle, 'cuMemRangeGetAttributes') - except: - pass + global __cuMemRangeGetAttributes + __cuMemRangeGetAttributes = windll.GetProcAddress(handle, 'cuMemRangeGetAttributes') {{endif}} {{if 'cuPointerSetAttribute' in found_functions}} - try: - global __cuPointerSetAttribute - __cuPointerSetAttribute = win32api.GetProcAddress(handle, 'cuPointerSetAttribute') - except: - pass + global __cuPointerSetAttribute + __cuPointerSetAttribute = windll.GetProcAddress(handle, 'cuPointerSetAttribute') {{endif}} {{if 'cuPointerGetAttributes' in found_functions}} - try: - global __cuPointerGetAttributes - __cuPointerGetAttributes = win32api.GetProcAddress(handle, 'cuPointerGetAttributes') - except: - pass + global __cuPointerGetAttributes + __cuPointerGetAttributes = windll.GetProcAddress(handle, 'cuPointerGetAttributes') {{endif}} {{if 'cuStreamCreate' in found_functions}} - try: - global __cuStreamCreate - __cuStreamCreate = win32api.GetProcAddress(handle, 'cuStreamCreate') - except: - pass + global __cuStreamCreate + __cuStreamCreate = windll.GetProcAddress(handle, 'cuStreamCreate') {{endif}} {{if 'cuStreamCreateWithPriority' in found_functions}} - try: - global __cuStreamCreateWithPriority - __cuStreamCreateWithPriority = win32api.GetProcAddress(handle, 'cuStreamCreateWithPriority') - except: - pass + global __cuStreamCreateWithPriority + __cuStreamCreateWithPriority = windll.GetProcAddress(handle, 'cuStreamCreateWithPriority') {{endif}} {{if 'cuThreadExchangeStreamCaptureMode' in found_functions}} - try: - global __cuThreadExchangeStreamCaptureMode - __cuThreadExchangeStreamCaptureMode = win32api.GetProcAddress(handle, 'cuThreadExchangeStreamCaptureMode') - except: - pass + global __cuThreadExchangeStreamCaptureMode + __cuThreadExchangeStreamCaptureMode = windll.GetProcAddress(handle, 'cuThreadExchangeStreamCaptureMode') {{endif}} {{if 'cuStreamDestroy_v2' in found_functions}} - try: - global __cuStreamDestroy_v2 - __cuStreamDestroy_v2 = win32api.GetProcAddress(handle, 'cuStreamDestroy_v2') - except: - pass + global __cuStreamDestroy_v2 + __cuStreamDestroy_v2 = windll.GetProcAddress(handle, 'cuStreamDestroy_v2') {{endif}} {{if 'cuEventCreate' in found_functions}} - try: - global __cuEventCreate - __cuEventCreate = win32api.GetProcAddress(handle, 'cuEventCreate') - except: - pass + global __cuEventCreate + __cuEventCreate = windll.GetProcAddress(handle, 'cuEventCreate') {{endif}} {{if 'cuEventQuery' in found_functions}} - try: - global __cuEventQuery - __cuEventQuery = win32api.GetProcAddress(handle, 'cuEventQuery') - except: - pass + global __cuEventQuery + __cuEventQuery = windll.GetProcAddress(handle, 'cuEventQuery') {{endif}} {{if 'cuEventSynchronize' in found_functions}} - try: - global __cuEventSynchronize - __cuEventSynchronize = win32api.GetProcAddress(handle, 'cuEventSynchronize') - except: - pass + global __cuEventSynchronize + __cuEventSynchronize = windll.GetProcAddress(handle, 'cuEventSynchronize') {{endif}} {{if 'cuEventDestroy_v2' in found_functions}} - try: - global __cuEventDestroy_v2 - __cuEventDestroy_v2 = win32api.GetProcAddress(handle, 'cuEventDestroy_v2') - except: - pass + global __cuEventDestroy_v2 + __cuEventDestroy_v2 = windll.GetProcAddress(handle, 'cuEventDestroy_v2') {{endif}} {{if 'cuEventElapsedTime_v2' in found_functions}} - try: - global __cuEventElapsedTime_v2 - __cuEventElapsedTime_v2 = win32api.GetProcAddress(handle, 'cuEventElapsedTime_v2') - except: - pass + global __cuEventElapsedTime_v2 + __cuEventElapsedTime_v2 = windll.GetProcAddress(handle, 'cuEventElapsedTime_v2') {{endif}} {{if 'cuImportExternalMemory' in found_functions}} - try: - global __cuImportExternalMemory - __cuImportExternalMemory = win32api.GetProcAddress(handle, 'cuImportExternalMemory') - except: - pass + global __cuImportExternalMemory + __cuImportExternalMemory = windll.GetProcAddress(handle, 'cuImportExternalMemory') {{endif}} {{if 'cuExternalMemoryGetMappedBuffer' in found_functions}} - try: - global __cuExternalMemoryGetMappedBuffer - __cuExternalMemoryGetMappedBuffer = win32api.GetProcAddress(handle, 'cuExternalMemoryGetMappedBuffer') - except: - pass + global __cuExternalMemoryGetMappedBuffer + __cuExternalMemoryGetMappedBuffer = windll.GetProcAddress(handle, 'cuExternalMemoryGetMappedBuffer') {{endif}} {{if 'cuExternalMemoryGetMappedMipmappedArray' in found_functions}} - try: - global __cuExternalMemoryGetMappedMipmappedArray - __cuExternalMemoryGetMappedMipmappedArray = win32api.GetProcAddress(handle, 'cuExternalMemoryGetMappedMipmappedArray') - except: - pass + global __cuExternalMemoryGetMappedMipmappedArray + __cuExternalMemoryGetMappedMipmappedArray = windll.GetProcAddress(handle, 'cuExternalMemoryGetMappedMipmappedArray') {{endif}} {{if 'cuDestroyExternalMemory' in found_functions}} - try: - global __cuDestroyExternalMemory - __cuDestroyExternalMemory = win32api.GetProcAddress(handle, 'cuDestroyExternalMemory') - except: - pass + global __cuDestroyExternalMemory + __cuDestroyExternalMemory = windll.GetProcAddress(handle, 'cuDestroyExternalMemory') {{endif}} {{if 'cuImportExternalSemaphore' in found_functions}} - try: - global __cuImportExternalSemaphore - __cuImportExternalSemaphore = win32api.GetProcAddress(handle, 'cuImportExternalSemaphore') - except: - pass + global __cuImportExternalSemaphore + __cuImportExternalSemaphore = windll.GetProcAddress(handle, 'cuImportExternalSemaphore') {{endif}} {{if 'cuDestroyExternalSemaphore' in found_functions}} - try: - global __cuDestroyExternalSemaphore - __cuDestroyExternalSemaphore = win32api.GetProcAddress(handle, 'cuDestroyExternalSemaphore') - except: - pass + global __cuDestroyExternalSemaphore + __cuDestroyExternalSemaphore = windll.GetProcAddress(handle, 'cuDestroyExternalSemaphore') {{endif}} {{if 'cuFuncGetAttribute' in found_functions}} - try: - global __cuFuncGetAttribute - __cuFuncGetAttribute = win32api.GetProcAddress(handle, 'cuFuncGetAttribute') - except: - pass + global __cuFuncGetAttribute + __cuFuncGetAttribute = windll.GetProcAddress(handle, 'cuFuncGetAttribute') {{endif}} {{if 'cuFuncSetAttribute' in found_functions}} - try: - global __cuFuncSetAttribute - __cuFuncSetAttribute = win32api.GetProcAddress(handle, 'cuFuncSetAttribute') - except: - pass + global __cuFuncSetAttribute + __cuFuncSetAttribute = windll.GetProcAddress(handle, 'cuFuncSetAttribute') {{endif}} {{if 'cuFuncSetCacheConfig' in found_functions}} - try: - global __cuFuncSetCacheConfig - __cuFuncSetCacheConfig = win32api.GetProcAddress(handle, 'cuFuncSetCacheConfig') - except: - pass + global __cuFuncSetCacheConfig + __cuFuncSetCacheConfig = windll.GetProcAddress(handle, 'cuFuncSetCacheConfig') {{endif}} {{if 'cuFuncGetModule' in found_functions}} - try: - global __cuFuncGetModule - __cuFuncGetModule = win32api.GetProcAddress(handle, 'cuFuncGetModule') - except: - pass + global __cuFuncGetModule + __cuFuncGetModule = windll.GetProcAddress(handle, 'cuFuncGetModule') {{endif}} {{if 'cuFuncGetName' in found_functions}} - try: - global __cuFuncGetName - __cuFuncGetName = win32api.GetProcAddress(handle, 'cuFuncGetName') - except: - pass + global __cuFuncGetName + __cuFuncGetName = windll.GetProcAddress(handle, 'cuFuncGetName') {{endif}} {{if 'cuFuncGetParamInfo' in found_functions}} - try: - global __cuFuncGetParamInfo - __cuFuncGetParamInfo = win32api.GetProcAddress(handle, 'cuFuncGetParamInfo') - except: - pass + global __cuFuncGetParamInfo + __cuFuncGetParamInfo = windll.GetProcAddress(handle, 'cuFuncGetParamInfo') {{endif}} {{if 'cuFuncIsLoaded' in found_functions}} - try: - global __cuFuncIsLoaded - __cuFuncIsLoaded = win32api.GetProcAddress(handle, 'cuFuncIsLoaded') - except: - pass + global __cuFuncIsLoaded + __cuFuncIsLoaded = windll.GetProcAddress(handle, 'cuFuncIsLoaded') {{endif}} {{if 'cuFuncLoad' in found_functions}} - try: - global __cuFuncLoad - __cuFuncLoad = win32api.GetProcAddress(handle, 'cuFuncLoad') - except: - pass + global __cuFuncLoad + __cuFuncLoad = windll.GetProcAddress(handle, 'cuFuncLoad') {{endif}} {{if 'cuLaunchCooperativeKernelMultiDevice' in found_functions}} - try: - global __cuLaunchCooperativeKernelMultiDevice - __cuLaunchCooperativeKernelMultiDevice = win32api.GetProcAddress(handle, 'cuLaunchCooperativeKernelMultiDevice') - except: - pass + global __cuLaunchCooperativeKernelMultiDevice + __cuLaunchCooperativeKernelMultiDevice = windll.GetProcAddress(handle, 'cuLaunchCooperativeKernelMultiDevice') {{endif}} {{if 'cuFuncSetBlockShape' in found_functions}} - try: - global __cuFuncSetBlockShape - __cuFuncSetBlockShape = win32api.GetProcAddress(handle, 'cuFuncSetBlockShape') - except: - pass + global __cuFuncSetBlockShape + __cuFuncSetBlockShape = windll.GetProcAddress(handle, 'cuFuncSetBlockShape') {{endif}} {{if 'cuFuncSetSharedSize' in found_functions}} - try: - global __cuFuncSetSharedSize - __cuFuncSetSharedSize = win32api.GetProcAddress(handle, 'cuFuncSetSharedSize') - except: - pass + global __cuFuncSetSharedSize + __cuFuncSetSharedSize = windll.GetProcAddress(handle, 'cuFuncSetSharedSize') {{endif}} {{if 'cuParamSetSize' in found_functions}} - try: - global __cuParamSetSize - __cuParamSetSize = win32api.GetProcAddress(handle, 'cuParamSetSize') - except: - pass + global __cuParamSetSize + __cuParamSetSize = windll.GetProcAddress(handle, 'cuParamSetSize') {{endif}} {{if 'cuParamSeti' in found_functions}} - try: - global __cuParamSeti - __cuParamSeti = win32api.GetProcAddress(handle, 'cuParamSeti') - except: - pass + global __cuParamSeti + __cuParamSeti = windll.GetProcAddress(handle, 'cuParamSeti') {{endif}} {{if 'cuParamSetf' in found_functions}} - try: - global __cuParamSetf - __cuParamSetf = win32api.GetProcAddress(handle, 'cuParamSetf') - except: - pass + global __cuParamSetf + __cuParamSetf = windll.GetProcAddress(handle, 'cuParamSetf') {{endif}} {{if 'cuParamSetv' in found_functions}} - try: - global __cuParamSetv - __cuParamSetv = win32api.GetProcAddress(handle, 'cuParamSetv') - except: - pass + global __cuParamSetv + __cuParamSetv = windll.GetProcAddress(handle, 'cuParamSetv') {{endif}} {{if 'cuLaunch' in found_functions}} - try: - global __cuLaunch - __cuLaunch = win32api.GetProcAddress(handle, 'cuLaunch') - except: - pass + global __cuLaunch + __cuLaunch = windll.GetProcAddress(handle, 'cuLaunch') {{endif}} {{if 'cuLaunchGrid' in found_functions}} - try: - global __cuLaunchGrid - __cuLaunchGrid = win32api.GetProcAddress(handle, 'cuLaunchGrid') - except: - pass + global __cuLaunchGrid + __cuLaunchGrid = windll.GetProcAddress(handle, 'cuLaunchGrid') {{endif}} {{if 'cuLaunchGridAsync' in found_functions}} - try: - global __cuLaunchGridAsync - __cuLaunchGridAsync = win32api.GetProcAddress(handle, 'cuLaunchGridAsync') - except: - pass + global __cuLaunchGridAsync + __cuLaunchGridAsync = windll.GetProcAddress(handle, 'cuLaunchGridAsync') {{endif}} {{if 'cuParamSetTexRef' in found_functions}} - try: - global __cuParamSetTexRef - __cuParamSetTexRef = win32api.GetProcAddress(handle, 'cuParamSetTexRef') - except: - pass + global __cuParamSetTexRef + __cuParamSetTexRef = windll.GetProcAddress(handle, 'cuParamSetTexRef') {{endif}} {{if 'cuFuncSetSharedMemConfig' in found_functions}} - try: - global __cuFuncSetSharedMemConfig - __cuFuncSetSharedMemConfig = win32api.GetProcAddress(handle, 'cuFuncSetSharedMemConfig') - except: - pass + global __cuFuncSetSharedMemConfig + __cuFuncSetSharedMemConfig = windll.GetProcAddress(handle, 'cuFuncSetSharedMemConfig') {{endif}} {{if 'cuGraphCreate' in found_functions}} - try: - global __cuGraphCreate - __cuGraphCreate = win32api.GetProcAddress(handle, 'cuGraphCreate') - except: - pass + global __cuGraphCreate + __cuGraphCreate = windll.GetProcAddress(handle, 'cuGraphCreate') {{endif}} {{if 'cuGraphAddKernelNode_v2' in found_functions}} - try: - global __cuGraphAddKernelNode_v2 - __cuGraphAddKernelNode_v2 = win32api.GetProcAddress(handle, 'cuGraphAddKernelNode_v2') - except: - pass + global __cuGraphAddKernelNode_v2 + __cuGraphAddKernelNode_v2 = windll.GetProcAddress(handle, 'cuGraphAddKernelNode_v2') {{endif}} {{if 'cuGraphKernelNodeGetParams_v2' in found_functions}} - try: - global __cuGraphKernelNodeGetParams_v2 - __cuGraphKernelNodeGetParams_v2 = win32api.GetProcAddress(handle, 'cuGraphKernelNodeGetParams_v2') - except: - pass + global __cuGraphKernelNodeGetParams_v2 + __cuGraphKernelNodeGetParams_v2 = windll.GetProcAddress(handle, 'cuGraphKernelNodeGetParams_v2') {{endif}} {{if 'cuGraphKernelNodeSetParams_v2' in found_functions}} - try: - global __cuGraphKernelNodeSetParams_v2 - __cuGraphKernelNodeSetParams_v2 = win32api.GetProcAddress(handle, 'cuGraphKernelNodeSetParams_v2') - except: - pass + global __cuGraphKernelNodeSetParams_v2 + __cuGraphKernelNodeSetParams_v2 = windll.GetProcAddress(handle, 'cuGraphKernelNodeSetParams_v2') {{endif}} {{if 'cuGraphAddMemcpyNode' in found_functions}} - try: - global __cuGraphAddMemcpyNode - __cuGraphAddMemcpyNode = win32api.GetProcAddress(handle, 'cuGraphAddMemcpyNode') - except: - pass + global __cuGraphAddMemcpyNode + __cuGraphAddMemcpyNode = windll.GetProcAddress(handle, 'cuGraphAddMemcpyNode') {{endif}} {{if 'cuGraphMemcpyNodeGetParams' in found_functions}} - try: - global __cuGraphMemcpyNodeGetParams - __cuGraphMemcpyNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphMemcpyNodeGetParams') - except: - pass + global __cuGraphMemcpyNodeGetParams + __cuGraphMemcpyNodeGetParams = windll.GetProcAddress(handle, 'cuGraphMemcpyNodeGetParams') {{endif}} {{if 'cuGraphMemcpyNodeSetParams' in found_functions}} - try: - global __cuGraphMemcpyNodeSetParams - __cuGraphMemcpyNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphMemcpyNodeSetParams') - except: - pass + global __cuGraphMemcpyNodeSetParams + __cuGraphMemcpyNodeSetParams = windll.GetProcAddress(handle, 'cuGraphMemcpyNodeSetParams') {{endif}} {{if 'cuGraphAddMemsetNode' in found_functions}} - try: - global __cuGraphAddMemsetNode - __cuGraphAddMemsetNode = win32api.GetProcAddress(handle, 'cuGraphAddMemsetNode') - except: - pass + global __cuGraphAddMemsetNode + __cuGraphAddMemsetNode = windll.GetProcAddress(handle, 'cuGraphAddMemsetNode') {{endif}} {{if 'cuGraphMemsetNodeGetParams' in found_functions}} - try: - global __cuGraphMemsetNodeGetParams - __cuGraphMemsetNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphMemsetNodeGetParams') - except: - pass + global __cuGraphMemsetNodeGetParams + __cuGraphMemsetNodeGetParams = windll.GetProcAddress(handle, 'cuGraphMemsetNodeGetParams') {{endif}} {{if 'cuGraphMemsetNodeSetParams' in found_functions}} - try: - global __cuGraphMemsetNodeSetParams - __cuGraphMemsetNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphMemsetNodeSetParams') - except: - pass + global __cuGraphMemsetNodeSetParams + __cuGraphMemsetNodeSetParams = windll.GetProcAddress(handle, 'cuGraphMemsetNodeSetParams') {{endif}} {{if 'cuGraphAddHostNode' in found_functions}} - try: - global __cuGraphAddHostNode - __cuGraphAddHostNode = win32api.GetProcAddress(handle, 'cuGraphAddHostNode') - except: - pass + global __cuGraphAddHostNode + __cuGraphAddHostNode = windll.GetProcAddress(handle, 'cuGraphAddHostNode') {{endif}} {{if 'cuGraphHostNodeGetParams' in found_functions}} - try: - global __cuGraphHostNodeGetParams - __cuGraphHostNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphHostNodeGetParams') - except: - pass + global __cuGraphHostNodeGetParams + __cuGraphHostNodeGetParams = windll.GetProcAddress(handle, 'cuGraphHostNodeGetParams') {{endif}} {{if 'cuGraphHostNodeSetParams' in found_functions}} - try: - global __cuGraphHostNodeSetParams - __cuGraphHostNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphHostNodeSetParams') - except: - pass + global __cuGraphHostNodeSetParams + __cuGraphHostNodeSetParams = windll.GetProcAddress(handle, 'cuGraphHostNodeSetParams') {{endif}} {{if 'cuGraphAddChildGraphNode' in found_functions}} - try: - global __cuGraphAddChildGraphNode - __cuGraphAddChildGraphNode = win32api.GetProcAddress(handle, 'cuGraphAddChildGraphNode') - except: - pass + global __cuGraphAddChildGraphNode + __cuGraphAddChildGraphNode = windll.GetProcAddress(handle, 'cuGraphAddChildGraphNode') {{endif}} {{if 'cuGraphChildGraphNodeGetGraph' in found_functions}} - try: - global __cuGraphChildGraphNodeGetGraph - __cuGraphChildGraphNodeGetGraph = win32api.GetProcAddress(handle, 'cuGraphChildGraphNodeGetGraph') - except: - pass + global __cuGraphChildGraphNodeGetGraph + __cuGraphChildGraphNodeGetGraph = windll.GetProcAddress(handle, 'cuGraphChildGraphNodeGetGraph') {{endif}} {{if 'cuGraphAddEmptyNode' in found_functions}} - try: - global __cuGraphAddEmptyNode - __cuGraphAddEmptyNode = win32api.GetProcAddress(handle, 'cuGraphAddEmptyNode') - except: - pass + global __cuGraphAddEmptyNode + __cuGraphAddEmptyNode = windll.GetProcAddress(handle, 'cuGraphAddEmptyNode') {{endif}} - {{if 'cuGraphAddEventRecordNode' in found_functions}} - try: - global __cuGraphAddEventRecordNode - __cuGraphAddEventRecordNode = win32api.GetProcAddress(handle, 'cuGraphAddEventRecordNode') - except: - pass + {{if 'cuGraphAddEventRecordNode' in found_functions}} + global __cuGraphAddEventRecordNode + __cuGraphAddEventRecordNode = windll.GetProcAddress(handle, 'cuGraphAddEventRecordNode') {{endif}} {{if 'cuGraphEventRecordNodeGetEvent' in found_functions}} - try: - global __cuGraphEventRecordNodeGetEvent - __cuGraphEventRecordNodeGetEvent = win32api.GetProcAddress(handle, 'cuGraphEventRecordNodeGetEvent') - except: - pass + global __cuGraphEventRecordNodeGetEvent + __cuGraphEventRecordNodeGetEvent = windll.GetProcAddress(handle, 'cuGraphEventRecordNodeGetEvent') {{endif}} {{if 'cuGraphEventRecordNodeSetEvent' in found_functions}} - try: - global __cuGraphEventRecordNodeSetEvent - __cuGraphEventRecordNodeSetEvent = win32api.GetProcAddress(handle, 'cuGraphEventRecordNodeSetEvent') - except: - pass + global __cuGraphEventRecordNodeSetEvent + __cuGraphEventRecordNodeSetEvent = windll.GetProcAddress(handle, 'cuGraphEventRecordNodeSetEvent') {{endif}} {{if 'cuGraphAddEventWaitNode' in found_functions}} - try: - global __cuGraphAddEventWaitNode - __cuGraphAddEventWaitNode = win32api.GetProcAddress(handle, 'cuGraphAddEventWaitNode') - except: - pass + global __cuGraphAddEventWaitNode + __cuGraphAddEventWaitNode = windll.GetProcAddress(handle, 'cuGraphAddEventWaitNode') {{endif}} {{if 'cuGraphEventWaitNodeGetEvent' in found_functions}} - try: - global __cuGraphEventWaitNodeGetEvent - __cuGraphEventWaitNodeGetEvent = win32api.GetProcAddress(handle, 'cuGraphEventWaitNodeGetEvent') - except: - pass + global __cuGraphEventWaitNodeGetEvent + __cuGraphEventWaitNodeGetEvent = windll.GetProcAddress(handle, 'cuGraphEventWaitNodeGetEvent') {{endif}} {{if 'cuGraphEventWaitNodeSetEvent' in found_functions}} - try: - global __cuGraphEventWaitNodeSetEvent - __cuGraphEventWaitNodeSetEvent = win32api.GetProcAddress(handle, 'cuGraphEventWaitNodeSetEvent') - except: - pass + global __cuGraphEventWaitNodeSetEvent + __cuGraphEventWaitNodeSetEvent = windll.GetProcAddress(handle, 'cuGraphEventWaitNodeSetEvent') {{endif}} {{if 'cuGraphAddExternalSemaphoresSignalNode' in found_functions}} - try: - global __cuGraphAddExternalSemaphoresSignalNode - __cuGraphAddExternalSemaphoresSignalNode = win32api.GetProcAddress(handle, 'cuGraphAddExternalSemaphoresSignalNode') - except: - pass + global __cuGraphAddExternalSemaphoresSignalNode + __cuGraphAddExternalSemaphoresSignalNode = windll.GetProcAddress(handle, 'cuGraphAddExternalSemaphoresSignalNode') {{endif}} {{if 'cuGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - try: - global __cuGraphExternalSemaphoresSignalNodeGetParams - __cuGraphExternalSemaphoresSignalNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphExternalSemaphoresSignalNodeGetParams') - except: - pass + global __cuGraphExternalSemaphoresSignalNodeGetParams + __cuGraphExternalSemaphoresSignalNodeGetParams = windll.GetProcAddress(handle, 'cuGraphExternalSemaphoresSignalNodeGetParams') {{endif}} {{if 'cuGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - try: - global __cuGraphExternalSemaphoresSignalNodeSetParams - __cuGraphExternalSemaphoresSignalNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExternalSemaphoresSignalNodeSetParams') - except: - pass + global __cuGraphExternalSemaphoresSignalNodeSetParams + __cuGraphExternalSemaphoresSignalNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExternalSemaphoresSignalNodeSetParams') {{endif}} {{if 'cuGraphAddExternalSemaphoresWaitNode' in found_functions}} - try: - global __cuGraphAddExternalSemaphoresWaitNode - __cuGraphAddExternalSemaphoresWaitNode = win32api.GetProcAddress(handle, 'cuGraphAddExternalSemaphoresWaitNode') - except: - pass + global __cuGraphAddExternalSemaphoresWaitNode + __cuGraphAddExternalSemaphoresWaitNode = windll.GetProcAddress(handle, 'cuGraphAddExternalSemaphoresWaitNode') {{endif}} {{if 'cuGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - try: - global __cuGraphExternalSemaphoresWaitNodeGetParams - __cuGraphExternalSemaphoresWaitNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphExternalSemaphoresWaitNodeGetParams') - except: - pass + global __cuGraphExternalSemaphoresWaitNodeGetParams + __cuGraphExternalSemaphoresWaitNodeGetParams = windll.GetProcAddress(handle, 'cuGraphExternalSemaphoresWaitNodeGetParams') {{endif}} {{if 'cuGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - try: - global __cuGraphExternalSemaphoresWaitNodeSetParams - __cuGraphExternalSemaphoresWaitNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExternalSemaphoresWaitNodeSetParams') - except: - pass + global __cuGraphExternalSemaphoresWaitNodeSetParams + __cuGraphExternalSemaphoresWaitNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExternalSemaphoresWaitNodeSetParams') {{endif}} {{if 'cuGraphAddBatchMemOpNode' in found_functions}} - try: - global __cuGraphAddBatchMemOpNode - __cuGraphAddBatchMemOpNode = win32api.GetProcAddress(handle, 'cuGraphAddBatchMemOpNode') - except: - pass + global __cuGraphAddBatchMemOpNode + __cuGraphAddBatchMemOpNode = windll.GetProcAddress(handle, 'cuGraphAddBatchMemOpNode') {{endif}} {{if 'cuGraphBatchMemOpNodeGetParams' in found_functions}} - try: - global __cuGraphBatchMemOpNodeGetParams - __cuGraphBatchMemOpNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphBatchMemOpNodeGetParams') - except: - pass + global __cuGraphBatchMemOpNodeGetParams + __cuGraphBatchMemOpNodeGetParams = windll.GetProcAddress(handle, 'cuGraphBatchMemOpNodeGetParams') {{endif}} {{if 'cuGraphBatchMemOpNodeSetParams' in found_functions}} - try: - global __cuGraphBatchMemOpNodeSetParams - __cuGraphBatchMemOpNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphBatchMemOpNodeSetParams') - except: - pass + global __cuGraphBatchMemOpNodeSetParams + __cuGraphBatchMemOpNodeSetParams = windll.GetProcAddress(handle, 'cuGraphBatchMemOpNodeSetParams') {{endif}} {{if 'cuGraphExecBatchMemOpNodeSetParams' in found_functions}} - try: - global __cuGraphExecBatchMemOpNodeSetParams - __cuGraphExecBatchMemOpNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecBatchMemOpNodeSetParams') - except: - pass + global __cuGraphExecBatchMemOpNodeSetParams + __cuGraphExecBatchMemOpNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExecBatchMemOpNodeSetParams') {{endif}} {{if 'cuGraphAddMemAllocNode' in found_functions}} - try: - global __cuGraphAddMemAllocNode - __cuGraphAddMemAllocNode = win32api.GetProcAddress(handle, 'cuGraphAddMemAllocNode') - except: - pass + global __cuGraphAddMemAllocNode + __cuGraphAddMemAllocNode = windll.GetProcAddress(handle, 'cuGraphAddMemAllocNode') {{endif}} {{if 'cuGraphMemAllocNodeGetParams' in found_functions}} - try: - global __cuGraphMemAllocNodeGetParams - __cuGraphMemAllocNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphMemAllocNodeGetParams') - except: - pass + global __cuGraphMemAllocNodeGetParams + __cuGraphMemAllocNodeGetParams = windll.GetProcAddress(handle, 'cuGraphMemAllocNodeGetParams') {{endif}} {{if 'cuGraphAddMemFreeNode' in found_functions}} - try: - global __cuGraphAddMemFreeNode - __cuGraphAddMemFreeNode = win32api.GetProcAddress(handle, 'cuGraphAddMemFreeNode') - except: - pass + global __cuGraphAddMemFreeNode + __cuGraphAddMemFreeNode = windll.GetProcAddress(handle, 'cuGraphAddMemFreeNode') {{endif}} {{if 'cuGraphMemFreeNodeGetParams' in found_functions}} - try: - global __cuGraphMemFreeNodeGetParams - __cuGraphMemFreeNodeGetParams = win32api.GetProcAddress(handle, 'cuGraphMemFreeNodeGetParams') - except: - pass + global __cuGraphMemFreeNodeGetParams + __cuGraphMemFreeNodeGetParams = windll.GetProcAddress(handle, 'cuGraphMemFreeNodeGetParams') {{endif}} {{if 'cuDeviceGraphMemTrim' in found_functions}} - try: - global __cuDeviceGraphMemTrim - __cuDeviceGraphMemTrim = win32api.GetProcAddress(handle, 'cuDeviceGraphMemTrim') - except: - pass + global __cuDeviceGraphMemTrim + __cuDeviceGraphMemTrim = windll.GetProcAddress(handle, 'cuDeviceGraphMemTrim') {{endif}} {{if 'cuDeviceGetGraphMemAttribute' in found_functions}} - try: - global __cuDeviceGetGraphMemAttribute - __cuDeviceGetGraphMemAttribute = win32api.GetProcAddress(handle, 'cuDeviceGetGraphMemAttribute') - except: - pass + global __cuDeviceGetGraphMemAttribute + __cuDeviceGetGraphMemAttribute = windll.GetProcAddress(handle, 'cuDeviceGetGraphMemAttribute') {{endif}} {{if 'cuDeviceSetGraphMemAttribute' in found_functions}} - try: - global __cuDeviceSetGraphMemAttribute - __cuDeviceSetGraphMemAttribute = win32api.GetProcAddress(handle, 'cuDeviceSetGraphMemAttribute') - except: - pass + global __cuDeviceSetGraphMemAttribute + __cuDeviceSetGraphMemAttribute = windll.GetProcAddress(handle, 'cuDeviceSetGraphMemAttribute') {{endif}} {{if 'cuGraphClone' in found_functions}} - try: - global __cuGraphClone - __cuGraphClone = win32api.GetProcAddress(handle, 'cuGraphClone') - except: - pass + global __cuGraphClone + __cuGraphClone = windll.GetProcAddress(handle, 'cuGraphClone') {{endif}} {{if 'cuGraphNodeFindInClone' in found_functions}} - try: - global __cuGraphNodeFindInClone - __cuGraphNodeFindInClone = win32api.GetProcAddress(handle, 'cuGraphNodeFindInClone') - except: - pass + global __cuGraphNodeFindInClone + __cuGraphNodeFindInClone = windll.GetProcAddress(handle, 'cuGraphNodeFindInClone') {{endif}} {{if 'cuGraphNodeGetType' in found_functions}} - try: - global __cuGraphNodeGetType - __cuGraphNodeGetType = win32api.GetProcAddress(handle, 'cuGraphNodeGetType') - except: - pass + global __cuGraphNodeGetType + __cuGraphNodeGetType = windll.GetProcAddress(handle, 'cuGraphNodeGetType') {{endif}} {{if 'cuGraphGetNodes' in found_functions}} - try: - global __cuGraphGetNodes - __cuGraphGetNodes = win32api.GetProcAddress(handle, 'cuGraphGetNodes') - except: - pass + global __cuGraphGetNodes + __cuGraphGetNodes = windll.GetProcAddress(handle, 'cuGraphGetNodes') {{endif}} {{if 'cuGraphGetRootNodes' in found_functions}} - try: - global __cuGraphGetRootNodes - __cuGraphGetRootNodes = win32api.GetProcAddress(handle, 'cuGraphGetRootNodes') - except: - pass + global __cuGraphGetRootNodes + __cuGraphGetRootNodes = windll.GetProcAddress(handle, 'cuGraphGetRootNodes') {{endif}} {{if 'cuGraphGetEdges_v2' in found_functions}} - try: - global __cuGraphGetEdges_v2 - __cuGraphGetEdges_v2 = win32api.GetProcAddress(handle, 'cuGraphGetEdges_v2') - except: - pass + global __cuGraphGetEdges_v2 + __cuGraphGetEdges_v2 = windll.GetProcAddress(handle, 'cuGraphGetEdges_v2') {{endif}} {{if 'cuGraphNodeGetDependencies_v2' in found_functions}} - try: - global __cuGraphNodeGetDependencies_v2 - __cuGraphNodeGetDependencies_v2 = win32api.GetProcAddress(handle, 'cuGraphNodeGetDependencies_v2') - except: - pass + global __cuGraphNodeGetDependencies_v2 + __cuGraphNodeGetDependencies_v2 = windll.GetProcAddress(handle, 'cuGraphNodeGetDependencies_v2') {{endif}} {{if 'cuGraphNodeGetDependentNodes_v2' in found_functions}} - try: - global __cuGraphNodeGetDependentNodes_v2 - __cuGraphNodeGetDependentNodes_v2 = win32api.GetProcAddress(handle, 'cuGraphNodeGetDependentNodes_v2') - except: - pass + global __cuGraphNodeGetDependentNodes_v2 + __cuGraphNodeGetDependentNodes_v2 = windll.GetProcAddress(handle, 'cuGraphNodeGetDependentNodes_v2') {{endif}} {{if 'cuGraphAddDependencies_v2' in found_functions}} - try: - global __cuGraphAddDependencies_v2 - __cuGraphAddDependencies_v2 = win32api.GetProcAddress(handle, 'cuGraphAddDependencies_v2') - except: - pass + global __cuGraphAddDependencies_v2 + __cuGraphAddDependencies_v2 = windll.GetProcAddress(handle, 'cuGraphAddDependencies_v2') {{endif}} {{if 'cuGraphRemoveDependencies_v2' in found_functions}} - try: - global __cuGraphRemoveDependencies_v2 - __cuGraphRemoveDependencies_v2 = win32api.GetProcAddress(handle, 'cuGraphRemoveDependencies_v2') - except: - pass + global __cuGraphRemoveDependencies_v2 + __cuGraphRemoveDependencies_v2 = windll.GetProcAddress(handle, 'cuGraphRemoveDependencies_v2') {{endif}} {{if 'cuGraphDestroyNode' in found_functions}} - try: - global __cuGraphDestroyNode - __cuGraphDestroyNode = win32api.GetProcAddress(handle, 'cuGraphDestroyNode') - except: - pass + global __cuGraphDestroyNode + __cuGraphDestroyNode = windll.GetProcAddress(handle, 'cuGraphDestroyNode') {{endif}} {{if 'cuGraphInstantiateWithFlags' in found_functions}} - try: - global __cuGraphInstantiateWithFlags - __cuGraphInstantiateWithFlags = win32api.GetProcAddress(handle, 'cuGraphInstantiateWithFlags') - except: - pass + global __cuGraphInstantiateWithFlags + __cuGraphInstantiateWithFlags = windll.GetProcAddress(handle, 'cuGraphInstantiateWithFlags') {{endif}} {{if 'cuGraphExecGetFlags' in found_functions}} - try: - global __cuGraphExecGetFlags - __cuGraphExecGetFlags = win32api.GetProcAddress(handle, 'cuGraphExecGetFlags') - except: - pass + global __cuGraphExecGetFlags + __cuGraphExecGetFlags = windll.GetProcAddress(handle, 'cuGraphExecGetFlags') {{endif}} {{if 'cuGraphExecKernelNodeSetParams_v2' in found_functions}} - try: - global __cuGraphExecKernelNodeSetParams_v2 - __cuGraphExecKernelNodeSetParams_v2 = win32api.GetProcAddress(handle, 'cuGraphExecKernelNodeSetParams_v2') - except: - pass + global __cuGraphExecKernelNodeSetParams_v2 + __cuGraphExecKernelNodeSetParams_v2 = windll.GetProcAddress(handle, 'cuGraphExecKernelNodeSetParams_v2') {{endif}} {{if 'cuGraphExecMemcpyNodeSetParams' in found_functions}} - try: - global __cuGraphExecMemcpyNodeSetParams - __cuGraphExecMemcpyNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecMemcpyNodeSetParams') - except: - pass + global __cuGraphExecMemcpyNodeSetParams + __cuGraphExecMemcpyNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExecMemcpyNodeSetParams') {{endif}} {{if 'cuGraphExecMemsetNodeSetParams' in found_functions}} - try: - global __cuGraphExecMemsetNodeSetParams - __cuGraphExecMemsetNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecMemsetNodeSetParams') - except: - pass + global __cuGraphExecMemsetNodeSetParams + __cuGraphExecMemsetNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExecMemsetNodeSetParams') {{endif}} {{if 'cuGraphExecHostNodeSetParams' in found_functions}} - try: - global __cuGraphExecHostNodeSetParams - __cuGraphExecHostNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecHostNodeSetParams') - except: - pass + global __cuGraphExecHostNodeSetParams + __cuGraphExecHostNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExecHostNodeSetParams') {{endif}} {{if 'cuGraphExecChildGraphNodeSetParams' in found_functions}} - try: - global __cuGraphExecChildGraphNodeSetParams - __cuGraphExecChildGraphNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecChildGraphNodeSetParams') - except: - pass + global __cuGraphExecChildGraphNodeSetParams + __cuGraphExecChildGraphNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExecChildGraphNodeSetParams') {{endif}} {{if 'cuGraphExecEventRecordNodeSetEvent' in found_functions}} - try: - global __cuGraphExecEventRecordNodeSetEvent - __cuGraphExecEventRecordNodeSetEvent = win32api.GetProcAddress(handle, 'cuGraphExecEventRecordNodeSetEvent') - except: - pass + global __cuGraphExecEventRecordNodeSetEvent + __cuGraphExecEventRecordNodeSetEvent = windll.GetProcAddress(handle, 'cuGraphExecEventRecordNodeSetEvent') {{endif}} {{if 'cuGraphExecEventWaitNodeSetEvent' in found_functions}} - try: - global __cuGraphExecEventWaitNodeSetEvent - __cuGraphExecEventWaitNodeSetEvent = win32api.GetProcAddress(handle, 'cuGraphExecEventWaitNodeSetEvent') - except: - pass + global __cuGraphExecEventWaitNodeSetEvent + __cuGraphExecEventWaitNodeSetEvent = windll.GetProcAddress(handle, 'cuGraphExecEventWaitNodeSetEvent') {{endif}} {{if 'cuGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - try: - global __cuGraphExecExternalSemaphoresSignalNodeSetParams - __cuGraphExecExternalSemaphoresSignalNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecExternalSemaphoresSignalNodeSetParams') - except: - pass + global __cuGraphExecExternalSemaphoresSignalNodeSetParams + __cuGraphExecExternalSemaphoresSignalNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExecExternalSemaphoresSignalNodeSetParams') {{endif}} {{if 'cuGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - try: - global __cuGraphExecExternalSemaphoresWaitNodeSetParams - __cuGraphExecExternalSemaphoresWaitNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecExternalSemaphoresWaitNodeSetParams') - except: - pass + global __cuGraphExecExternalSemaphoresWaitNodeSetParams + __cuGraphExecExternalSemaphoresWaitNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExecExternalSemaphoresWaitNodeSetParams') {{endif}} {{if 'cuGraphNodeSetEnabled' in found_functions}} - try: - global __cuGraphNodeSetEnabled - __cuGraphNodeSetEnabled = win32api.GetProcAddress(handle, 'cuGraphNodeSetEnabled') - except: - pass + global __cuGraphNodeSetEnabled + __cuGraphNodeSetEnabled = windll.GetProcAddress(handle, 'cuGraphNodeSetEnabled') {{endif}} {{if 'cuGraphNodeGetEnabled' in found_functions}} - try: - global __cuGraphNodeGetEnabled - __cuGraphNodeGetEnabled = win32api.GetProcAddress(handle, 'cuGraphNodeGetEnabled') - except: - pass + global __cuGraphNodeGetEnabled + __cuGraphNodeGetEnabled = windll.GetProcAddress(handle, 'cuGraphNodeGetEnabled') {{endif}} {{if 'cuGraphExecDestroy' in found_functions}} - try: - global __cuGraphExecDestroy - __cuGraphExecDestroy = win32api.GetProcAddress(handle, 'cuGraphExecDestroy') - except: - pass + global __cuGraphExecDestroy + __cuGraphExecDestroy = windll.GetProcAddress(handle, 'cuGraphExecDestroy') {{endif}} {{if 'cuGraphDestroy' in found_functions}} - try: - global __cuGraphDestroy - __cuGraphDestroy = win32api.GetProcAddress(handle, 'cuGraphDestroy') - except: - pass + global __cuGraphDestroy + __cuGraphDestroy = windll.GetProcAddress(handle, 'cuGraphDestroy') {{endif}} {{if 'cuGraphExecUpdate_v2' in found_functions}} - try: - global __cuGraphExecUpdate_v2 - __cuGraphExecUpdate_v2 = win32api.GetProcAddress(handle, 'cuGraphExecUpdate_v2') - except: - pass + global __cuGraphExecUpdate_v2 + __cuGraphExecUpdate_v2 = windll.GetProcAddress(handle, 'cuGraphExecUpdate_v2') {{endif}} {{if 'cuGraphKernelNodeCopyAttributes' in found_functions}} - try: - global __cuGraphKernelNodeCopyAttributes - __cuGraphKernelNodeCopyAttributes = win32api.GetProcAddress(handle, 'cuGraphKernelNodeCopyAttributes') - except: - pass + global __cuGraphKernelNodeCopyAttributes + __cuGraphKernelNodeCopyAttributes = windll.GetProcAddress(handle, 'cuGraphKernelNodeCopyAttributes') {{endif}} {{if 'cuGraphKernelNodeGetAttribute' in found_functions}} - try: - global __cuGraphKernelNodeGetAttribute - __cuGraphKernelNodeGetAttribute = win32api.GetProcAddress(handle, 'cuGraphKernelNodeGetAttribute') - except: - pass + global __cuGraphKernelNodeGetAttribute + __cuGraphKernelNodeGetAttribute = windll.GetProcAddress(handle, 'cuGraphKernelNodeGetAttribute') {{endif}} {{if 'cuGraphKernelNodeSetAttribute' in found_functions}} - try: - global __cuGraphKernelNodeSetAttribute - __cuGraphKernelNodeSetAttribute = win32api.GetProcAddress(handle, 'cuGraphKernelNodeSetAttribute') - except: - pass + global __cuGraphKernelNodeSetAttribute + __cuGraphKernelNodeSetAttribute = windll.GetProcAddress(handle, 'cuGraphKernelNodeSetAttribute') {{endif}} {{if 'cuGraphDebugDotPrint' in found_functions}} - try: - global __cuGraphDebugDotPrint - __cuGraphDebugDotPrint = win32api.GetProcAddress(handle, 'cuGraphDebugDotPrint') - except: - pass + global __cuGraphDebugDotPrint + __cuGraphDebugDotPrint = windll.GetProcAddress(handle, 'cuGraphDebugDotPrint') {{endif}} {{if 'cuUserObjectCreate' in found_functions}} - try: - global __cuUserObjectCreate - __cuUserObjectCreate = win32api.GetProcAddress(handle, 'cuUserObjectCreate') - except: - pass + global __cuUserObjectCreate + __cuUserObjectCreate = windll.GetProcAddress(handle, 'cuUserObjectCreate') {{endif}} {{if 'cuUserObjectRetain' in found_functions}} - try: - global __cuUserObjectRetain - __cuUserObjectRetain = win32api.GetProcAddress(handle, 'cuUserObjectRetain') - except: - pass + global __cuUserObjectRetain + __cuUserObjectRetain = windll.GetProcAddress(handle, 'cuUserObjectRetain') {{endif}} {{if 'cuUserObjectRelease' in found_functions}} - try: - global __cuUserObjectRelease - __cuUserObjectRelease = win32api.GetProcAddress(handle, 'cuUserObjectRelease') - except: - pass + global __cuUserObjectRelease + __cuUserObjectRelease = windll.GetProcAddress(handle, 'cuUserObjectRelease') {{endif}} {{if 'cuGraphRetainUserObject' in found_functions}} - try: - global __cuGraphRetainUserObject - __cuGraphRetainUserObject = win32api.GetProcAddress(handle, 'cuGraphRetainUserObject') - except: - pass + global __cuGraphRetainUserObject + __cuGraphRetainUserObject = windll.GetProcAddress(handle, 'cuGraphRetainUserObject') {{endif}} {{if 'cuGraphReleaseUserObject' in found_functions}} - try: - global __cuGraphReleaseUserObject - __cuGraphReleaseUserObject = win32api.GetProcAddress(handle, 'cuGraphReleaseUserObject') - except: - pass + global __cuGraphReleaseUserObject + __cuGraphReleaseUserObject = windll.GetProcAddress(handle, 'cuGraphReleaseUserObject') {{endif}} {{if 'cuGraphAddNode_v2' in found_functions}} - try: - global __cuGraphAddNode_v2 - __cuGraphAddNode_v2 = win32api.GetProcAddress(handle, 'cuGraphAddNode_v2') - except: - pass + global __cuGraphAddNode_v2 + __cuGraphAddNode_v2 = windll.GetProcAddress(handle, 'cuGraphAddNode_v2') {{endif}} {{if 'cuGraphNodeSetParams' in found_functions}} - try: - global __cuGraphNodeSetParams - __cuGraphNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphNodeSetParams') - except: - pass + global __cuGraphNodeSetParams + __cuGraphNodeSetParams = windll.GetProcAddress(handle, 'cuGraphNodeSetParams') {{endif}} {{if 'cuGraphExecNodeSetParams' in found_functions}} - try: - global __cuGraphExecNodeSetParams - __cuGraphExecNodeSetParams = win32api.GetProcAddress(handle, 'cuGraphExecNodeSetParams') - except: - pass + global __cuGraphExecNodeSetParams + __cuGraphExecNodeSetParams = windll.GetProcAddress(handle, 'cuGraphExecNodeSetParams') {{endif}} {{if 'cuGraphConditionalHandleCreate' in found_functions}} - try: - global __cuGraphConditionalHandleCreate - __cuGraphConditionalHandleCreate = win32api.GetProcAddress(handle, 'cuGraphConditionalHandleCreate') - except: - pass + global __cuGraphConditionalHandleCreate + __cuGraphConditionalHandleCreate = windll.GetProcAddress(handle, 'cuGraphConditionalHandleCreate') {{endif}} {{if 'cuOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - try: - global __cuOccupancyMaxActiveBlocksPerMultiprocessor - __cuOccupancyMaxActiveBlocksPerMultiprocessor = win32api.GetProcAddress(handle, 'cuOccupancyMaxActiveBlocksPerMultiprocessor') - except: - pass + global __cuOccupancyMaxActiveBlocksPerMultiprocessor + __cuOccupancyMaxActiveBlocksPerMultiprocessor = windll.GetProcAddress(handle, 'cuOccupancyMaxActiveBlocksPerMultiprocessor') {{endif}} {{if 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - try: - global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags - __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = win32api.GetProcAddress(handle, 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags') - except: - pass + global __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + __cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = windll.GetProcAddress(handle, 'cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags') {{endif}} {{if 'cuOccupancyMaxPotentialBlockSize' in found_functions}} - try: - global __cuOccupancyMaxPotentialBlockSize - __cuOccupancyMaxPotentialBlockSize = win32api.GetProcAddress(handle, 'cuOccupancyMaxPotentialBlockSize') - except: - pass + global __cuOccupancyMaxPotentialBlockSize + __cuOccupancyMaxPotentialBlockSize = windll.GetProcAddress(handle, 'cuOccupancyMaxPotentialBlockSize') {{endif}} {{if 'cuOccupancyMaxPotentialBlockSizeWithFlags' in found_functions}} - try: - global __cuOccupancyMaxPotentialBlockSizeWithFlags - __cuOccupancyMaxPotentialBlockSizeWithFlags = win32api.GetProcAddress(handle, 'cuOccupancyMaxPotentialBlockSizeWithFlags') - except: - pass + global __cuOccupancyMaxPotentialBlockSizeWithFlags + __cuOccupancyMaxPotentialBlockSizeWithFlags = windll.GetProcAddress(handle, 'cuOccupancyMaxPotentialBlockSizeWithFlags') {{endif}} {{if 'cuOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - try: - global __cuOccupancyAvailableDynamicSMemPerBlock - __cuOccupancyAvailableDynamicSMemPerBlock = win32api.GetProcAddress(handle, 'cuOccupancyAvailableDynamicSMemPerBlock') - except: - pass + global __cuOccupancyAvailableDynamicSMemPerBlock + __cuOccupancyAvailableDynamicSMemPerBlock = windll.GetProcAddress(handle, 'cuOccupancyAvailableDynamicSMemPerBlock') {{endif}} {{if 'cuOccupancyMaxPotentialClusterSize' in found_functions}} - try: - global __cuOccupancyMaxPotentialClusterSize - __cuOccupancyMaxPotentialClusterSize = win32api.GetProcAddress(handle, 'cuOccupancyMaxPotentialClusterSize') - except: - pass + global __cuOccupancyMaxPotentialClusterSize + __cuOccupancyMaxPotentialClusterSize = windll.GetProcAddress(handle, 'cuOccupancyMaxPotentialClusterSize') {{endif}} {{if 'cuOccupancyMaxActiveClusters' in found_functions}} - try: - global __cuOccupancyMaxActiveClusters - __cuOccupancyMaxActiveClusters = win32api.GetProcAddress(handle, 'cuOccupancyMaxActiveClusters') - except: - pass + global __cuOccupancyMaxActiveClusters + __cuOccupancyMaxActiveClusters = windll.GetProcAddress(handle, 'cuOccupancyMaxActiveClusters') {{endif}} {{if 'cuTexRefSetArray' in found_functions}} - try: - global __cuTexRefSetArray - __cuTexRefSetArray = win32api.GetProcAddress(handle, 'cuTexRefSetArray') - except: - pass + global __cuTexRefSetArray + __cuTexRefSetArray = windll.GetProcAddress(handle, 'cuTexRefSetArray') {{endif}} {{if 'cuTexRefSetMipmappedArray' in found_functions}} - try: - global __cuTexRefSetMipmappedArray - __cuTexRefSetMipmappedArray = win32api.GetProcAddress(handle, 'cuTexRefSetMipmappedArray') - except: - pass + global __cuTexRefSetMipmappedArray + __cuTexRefSetMipmappedArray = windll.GetProcAddress(handle, 'cuTexRefSetMipmappedArray') {{endif}} {{if 'cuTexRefSetAddress_v2' in found_functions}} - try: - global __cuTexRefSetAddress_v2 - __cuTexRefSetAddress_v2 = win32api.GetProcAddress(handle, 'cuTexRefSetAddress_v2') - except: - pass + global __cuTexRefSetAddress_v2 + __cuTexRefSetAddress_v2 = windll.GetProcAddress(handle, 'cuTexRefSetAddress_v2') {{endif}} {{if 'cuTexRefSetAddress2D_v3' in found_functions}} - try: - global __cuTexRefSetAddress2D_v3 - __cuTexRefSetAddress2D_v3 = win32api.GetProcAddress(handle, 'cuTexRefSetAddress2D_v3') - except: - pass + global __cuTexRefSetAddress2D_v3 + __cuTexRefSetAddress2D_v3 = windll.GetProcAddress(handle, 'cuTexRefSetAddress2D_v3') {{endif}} {{if 'cuTexRefSetFormat' in found_functions}} - try: - global __cuTexRefSetFormat - __cuTexRefSetFormat = win32api.GetProcAddress(handle, 'cuTexRefSetFormat') - except: - pass + global __cuTexRefSetFormat + __cuTexRefSetFormat = windll.GetProcAddress(handle, 'cuTexRefSetFormat') {{endif}} {{if 'cuTexRefSetAddressMode' in found_functions}} - try: - global __cuTexRefSetAddressMode - __cuTexRefSetAddressMode = win32api.GetProcAddress(handle, 'cuTexRefSetAddressMode') - except: - pass + global __cuTexRefSetAddressMode + __cuTexRefSetAddressMode = windll.GetProcAddress(handle, 'cuTexRefSetAddressMode') {{endif}} {{if 'cuTexRefSetFilterMode' in found_functions}} - try: - global __cuTexRefSetFilterMode - __cuTexRefSetFilterMode = win32api.GetProcAddress(handle, 'cuTexRefSetFilterMode') - except: - pass + global __cuTexRefSetFilterMode + __cuTexRefSetFilterMode = windll.GetProcAddress(handle, 'cuTexRefSetFilterMode') {{endif}} {{if 'cuTexRefSetMipmapFilterMode' in found_functions}} - try: - global __cuTexRefSetMipmapFilterMode - __cuTexRefSetMipmapFilterMode = win32api.GetProcAddress(handle, 'cuTexRefSetMipmapFilterMode') - except: - pass + global __cuTexRefSetMipmapFilterMode + __cuTexRefSetMipmapFilterMode = windll.GetProcAddress(handle, 'cuTexRefSetMipmapFilterMode') {{endif}} {{if 'cuTexRefSetMipmapLevelBias' in found_functions}} - try: - global __cuTexRefSetMipmapLevelBias - __cuTexRefSetMipmapLevelBias = win32api.GetProcAddress(handle, 'cuTexRefSetMipmapLevelBias') - except: - pass + global __cuTexRefSetMipmapLevelBias + __cuTexRefSetMipmapLevelBias = windll.GetProcAddress(handle, 'cuTexRefSetMipmapLevelBias') {{endif}} {{if 'cuTexRefSetMipmapLevelClamp' in found_functions}} - try: - global __cuTexRefSetMipmapLevelClamp - __cuTexRefSetMipmapLevelClamp = win32api.GetProcAddress(handle, 'cuTexRefSetMipmapLevelClamp') - except: - pass + global __cuTexRefSetMipmapLevelClamp + __cuTexRefSetMipmapLevelClamp = windll.GetProcAddress(handle, 'cuTexRefSetMipmapLevelClamp') {{endif}} {{if 'cuTexRefSetMaxAnisotropy' in found_functions}} - try: - global __cuTexRefSetMaxAnisotropy - __cuTexRefSetMaxAnisotropy = win32api.GetProcAddress(handle, 'cuTexRefSetMaxAnisotropy') - except: - pass + global __cuTexRefSetMaxAnisotropy + __cuTexRefSetMaxAnisotropy = windll.GetProcAddress(handle, 'cuTexRefSetMaxAnisotropy') {{endif}} {{if 'cuTexRefSetBorderColor' in found_functions}} - try: - global __cuTexRefSetBorderColor - __cuTexRefSetBorderColor = win32api.GetProcAddress(handle, 'cuTexRefSetBorderColor') - except: - pass + global __cuTexRefSetBorderColor + __cuTexRefSetBorderColor = windll.GetProcAddress(handle, 'cuTexRefSetBorderColor') {{endif}} {{if 'cuTexRefSetFlags' in found_functions}} - try: - global __cuTexRefSetFlags - __cuTexRefSetFlags = win32api.GetProcAddress(handle, 'cuTexRefSetFlags') - except: - pass + global __cuTexRefSetFlags + __cuTexRefSetFlags = windll.GetProcAddress(handle, 'cuTexRefSetFlags') {{endif}} {{if 'cuTexRefGetAddress_v2' in found_functions}} - try: - global __cuTexRefGetAddress_v2 - __cuTexRefGetAddress_v2 = win32api.GetProcAddress(handle, 'cuTexRefGetAddress_v2') - except: - pass + global __cuTexRefGetAddress_v2 + __cuTexRefGetAddress_v2 = windll.GetProcAddress(handle, 'cuTexRefGetAddress_v2') {{endif}} {{if 'cuTexRefGetArray' in found_functions}} - try: - global __cuTexRefGetArray - __cuTexRefGetArray = win32api.GetProcAddress(handle, 'cuTexRefGetArray') - except: - pass + global __cuTexRefGetArray + __cuTexRefGetArray = windll.GetProcAddress(handle, 'cuTexRefGetArray') {{endif}} {{if 'cuTexRefGetMipmappedArray' in found_functions}} - try: - global __cuTexRefGetMipmappedArray - __cuTexRefGetMipmappedArray = win32api.GetProcAddress(handle, 'cuTexRefGetMipmappedArray') - except: - pass + global __cuTexRefGetMipmappedArray + __cuTexRefGetMipmappedArray = windll.GetProcAddress(handle, 'cuTexRefGetMipmappedArray') {{endif}} {{if 'cuTexRefGetAddressMode' in found_functions}} - try: - global __cuTexRefGetAddressMode - __cuTexRefGetAddressMode = win32api.GetProcAddress(handle, 'cuTexRefGetAddressMode') - except: - pass + global __cuTexRefGetAddressMode + __cuTexRefGetAddressMode = windll.GetProcAddress(handle, 'cuTexRefGetAddressMode') {{endif}} {{if 'cuTexRefGetFilterMode' in found_functions}} - try: - global __cuTexRefGetFilterMode - __cuTexRefGetFilterMode = win32api.GetProcAddress(handle, 'cuTexRefGetFilterMode') - except: - pass + global __cuTexRefGetFilterMode + __cuTexRefGetFilterMode = windll.GetProcAddress(handle, 'cuTexRefGetFilterMode') {{endif}} {{if 'cuTexRefGetFormat' in found_functions}} - try: - global __cuTexRefGetFormat - __cuTexRefGetFormat = win32api.GetProcAddress(handle, 'cuTexRefGetFormat') - except: - pass + global __cuTexRefGetFormat + __cuTexRefGetFormat = windll.GetProcAddress(handle, 'cuTexRefGetFormat') {{endif}} {{if 'cuTexRefGetMipmapFilterMode' in found_functions}} - try: - global __cuTexRefGetMipmapFilterMode - __cuTexRefGetMipmapFilterMode = win32api.GetProcAddress(handle, 'cuTexRefGetMipmapFilterMode') - except: - pass + global __cuTexRefGetMipmapFilterMode + __cuTexRefGetMipmapFilterMode = windll.GetProcAddress(handle, 'cuTexRefGetMipmapFilterMode') {{endif}} {{if 'cuTexRefGetMipmapLevelBias' in found_functions}} - try: - global __cuTexRefGetMipmapLevelBias - __cuTexRefGetMipmapLevelBias = win32api.GetProcAddress(handle, 'cuTexRefGetMipmapLevelBias') - except: - pass + global __cuTexRefGetMipmapLevelBias + __cuTexRefGetMipmapLevelBias = windll.GetProcAddress(handle, 'cuTexRefGetMipmapLevelBias') {{endif}} {{if 'cuTexRefGetMipmapLevelClamp' in found_functions}} - try: - global __cuTexRefGetMipmapLevelClamp - __cuTexRefGetMipmapLevelClamp = win32api.GetProcAddress(handle, 'cuTexRefGetMipmapLevelClamp') - except: - pass + global __cuTexRefGetMipmapLevelClamp + __cuTexRefGetMipmapLevelClamp = windll.GetProcAddress(handle, 'cuTexRefGetMipmapLevelClamp') {{endif}} {{if 'cuTexRefGetMaxAnisotropy' in found_functions}} - try: - global __cuTexRefGetMaxAnisotropy - __cuTexRefGetMaxAnisotropy = win32api.GetProcAddress(handle, 'cuTexRefGetMaxAnisotropy') - except: - pass + global __cuTexRefGetMaxAnisotropy + __cuTexRefGetMaxAnisotropy = windll.GetProcAddress(handle, 'cuTexRefGetMaxAnisotropy') {{endif}} {{if 'cuTexRefGetBorderColor' in found_functions}} - try: - global __cuTexRefGetBorderColor - __cuTexRefGetBorderColor = win32api.GetProcAddress(handle, 'cuTexRefGetBorderColor') - except: - pass + global __cuTexRefGetBorderColor + __cuTexRefGetBorderColor = windll.GetProcAddress(handle, 'cuTexRefGetBorderColor') {{endif}} {{if 'cuTexRefGetFlags' in found_functions}} - try: - global __cuTexRefGetFlags - __cuTexRefGetFlags = win32api.GetProcAddress(handle, 'cuTexRefGetFlags') - except: - pass + global __cuTexRefGetFlags + __cuTexRefGetFlags = windll.GetProcAddress(handle, 'cuTexRefGetFlags') {{endif}} {{if 'cuTexRefCreate' in found_functions}} - try: - global __cuTexRefCreate - __cuTexRefCreate = win32api.GetProcAddress(handle, 'cuTexRefCreate') - except: - pass + global __cuTexRefCreate + __cuTexRefCreate = windll.GetProcAddress(handle, 'cuTexRefCreate') {{endif}} {{if 'cuTexRefDestroy' in found_functions}} - try: - global __cuTexRefDestroy - __cuTexRefDestroy = win32api.GetProcAddress(handle, 'cuTexRefDestroy') - except: - pass + global __cuTexRefDestroy + __cuTexRefDestroy = windll.GetProcAddress(handle, 'cuTexRefDestroy') {{endif}} {{if 'cuSurfRefSetArray' in found_functions}} - try: - global __cuSurfRefSetArray - __cuSurfRefSetArray = win32api.GetProcAddress(handle, 'cuSurfRefSetArray') - except: - pass + global __cuSurfRefSetArray + __cuSurfRefSetArray = windll.GetProcAddress(handle, 'cuSurfRefSetArray') {{endif}} {{if 'cuSurfRefGetArray' in found_functions}} - try: - global __cuSurfRefGetArray - __cuSurfRefGetArray = win32api.GetProcAddress(handle, 'cuSurfRefGetArray') - except: - pass + global __cuSurfRefGetArray + __cuSurfRefGetArray = windll.GetProcAddress(handle, 'cuSurfRefGetArray') {{endif}} {{if 'cuTexObjectCreate' in found_functions}} - try: - global __cuTexObjectCreate - __cuTexObjectCreate = win32api.GetProcAddress(handle, 'cuTexObjectCreate') - except: - pass + global __cuTexObjectCreate + __cuTexObjectCreate = windll.GetProcAddress(handle, 'cuTexObjectCreate') {{endif}} {{if 'cuTexObjectDestroy' in found_functions}} - try: - global __cuTexObjectDestroy - __cuTexObjectDestroy = win32api.GetProcAddress(handle, 'cuTexObjectDestroy') - except: - pass + global __cuTexObjectDestroy + __cuTexObjectDestroy = windll.GetProcAddress(handle, 'cuTexObjectDestroy') {{endif}} {{if 'cuTexObjectGetResourceDesc' in found_functions}} - try: - global __cuTexObjectGetResourceDesc - __cuTexObjectGetResourceDesc = win32api.GetProcAddress(handle, 'cuTexObjectGetResourceDesc') - except: - pass + global __cuTexObjectGetResourceDesc + __cuTexObjectGetResourceDesc = windll.GetProcAddress(handle, 'cuTexObjectGetResourceDesc') {{endif}} {{if 'cuTexObjectGetTextureDesc' in found_functions}} - try: - global __cuTexObjectGetTextureDesc - __cuTexObjectGetTextureDesc = win32api.GetProcAddress(handle, 'cuTexObjectGetTextureDesc') - except: - pass + global __cuTexObjectGetTextureDesc + __cuTexObjectGetTextureDesc = windll.GetProcAddress(handle, 'cuTexObjectGetTextureDesc') {{endif}} {{if 'cuTexObjectGetResourceViewDesc' in found_functions}} - try: - global __cuTexObjectGetResourceViewDesc - __cuTexObjectGetResourceViewDesc = win32api.GetProcAddress(handle, 'cuTexObjectGetResourceViewDesc') - except: - pass + global __cuTexObjectGetResourceViewDesc + __cuTexObjectGetResourceViewDesc = windll.GetProcAddress(handle, 'cuTexObjectGetResourceViewDesc') {{endif}} {{if 'cuSurfObjectCreate' in found_functions}} - try: - global __cuSurfObjectCreate - __cuSurfObjectCreate = win32api.GetProcAddress(handle, 'cuSurfObjectCreate') - except: - pass + global __cuSurfObjectCreate + __cuSurfObjectCreate = windll.GetProcAddress(handle, 'cuSurfObjectCreate') {{endif}} {{if 'cuSurfObjectDestroy' in found_functions}} - try: - global __cuSurfObjectDestroy - __cuSurfObjectDestroy = win32api.GetProcAddress(handle, 'cuSurfObjectDestroy') - except: - pass + global __cuSurfObjectDestroy + __cuSurfObjectDestroy = windll.GetProcAddress(handle, 'cuSurfObjectDestroy') {{endif}} {{if 'cuSurfObjectGetResourceDesc' in found_functions}} - try: - global __cuSurfObjectGetResourceDesc - __cuSurfObjectGetResourceDesc = win32api.GetProcAddress(handle, 'cuSurfObjectGetResourceDesc') - except: - pass + global __cuSurfObjectGetResourceDesc + __cuSurfObjectGetResourceDesc = windll.GetProcAddress(handle, 'cuSurfObjectGetResourceDesc') {{endif}} {{if 'cuTensorMapEncodeTiled' in found_functions}} - try: - global __cuTensorMapEncodeTiled - __cuTensorMapEncodeTiled = win32api.GetProcAddress(handle, 'cuTensorMapEncodeTiled') - except: - pass + global __cuTensorMapEncodeTiled + __cuTensorMapEncodeTiled = windll.GetProcAddress(handle, 'cuTensorMapEncodeTiled') {{endif}} {{if 'cuTensorMapEncodeIm2col' in found_functions}} - try: - global __cuTensorMapEncodeIm2col - __cuTensorMapEncodeIm2col = win32api.GetProcAddress(handle, 'cuTensorMapEncodeIm2col') - except: - pass + global __cuTensorMapEncodeIm2col + __cuTensorMapEncodeIm2col = windll.GetProcAddress(handle, 'cuTensorMapEncodeIm2col') {{endif}} {{if 'cuTensorMapEncodeIm2colWide' in found_functions}} - try: - global __cuTensorMapEncodeIm2colWide - __cuTensorMapEncodeIm2colWide = win32api.GetProcAddress(handle, 'cuTensorMapEncodeIm2colWide') - except: - pass + global __cuTensorMapEncodeIm2colWide + __cuTensorMapEncodeIm2colWide = windll.GetProcAddress(handle, 'cuTensorMapEncodeIm2colWide') {{endif}} {{if 'cuTensorMapReplaceAddress' in found_functions}} - try: - global __cuTensorMapReplaceAddress - __cuTensorMapReplaceAddress = win32api.GetProcAddress(handle, 'cuTensorMapReplaceAddress') - except: - pass + global __cuTensorMapReplaceAddress + __cuTensorMapReplaceAddress = windll.GetProcAddress(handle, 'cuTensorMapReplaceAddress') {{endif}} {{if 'cuDeviceCanAccessPeer' in found_functions}} - try: - global __cuDeviceCanAccessPeer - __cuDeviceCanAccessPeer = win32api.GetProcAddress(handle, 'cuDeviceCanAccessPeer') - except: - pass + global __cuDeviceCanAccessPeer + __cuDeviceCanAccessPeer = windll.GetProcAddress(handle, 'cuDeviceCanAccessPeer') {{endif}} {{if 'cuCtxEnablePeerAccess' in found_functions}} - try: - global __cuCtxEnablePeerAccess - __cuCtxEnablePeerAccess = win32api.GetProcAddress(handle, 'cuCtxEnablePeerAccess') - except: - pass + global __cuCtxEnablePeerAccess + __cuCtxEnablePeerAccess = windll.GetProcAddress(handle, 'cuCtxEnablePeerAccess') {{endif}} {{if 'cuCtxDisablePeerAccess' in found_functions}} - try: - global __cuCtxDisablePeerAccess - __cuCtxDisablePeerAccess = win32api.GetProcAddress(handle, 'cuCtxDisablePeerAccess') - except: - pass + global __cuCtxDisablePeerAccess + __cuCtxDisablePeerAccess = windll.GetProcAddress(handle, 'cuCtxDisablePeerAccess') {{endif}} {{if 'cuDeviceGetP2PAttribute' in found_functions}} - try: - global __cuDeviceGetP2PAttribute - __cuDeviceGetP2PAttribute = win32api.GetProcAddress(handle, 'cuDeviceGetP2PAttribute') - except: - pass + global __cuDeviceGetP2PAttribute + __cuDeviceGetP2PAttribute = windll.GetProcAddress(handle, 'cuDeviceGetP2PAttribute') {{endif}} {{if 'cuDeviceGetP2PAtomicCapabilities' in found_functions}} - try: - global __cuDeviceGetP2PAtomicCapabilities - __cuDeviceGetP2PAtomicCapabilities = win32api.GetProcAddress(handle, 'cuDeviceGetP2PAtomicCapabilities') - except: - pass + global __cuDeviceGetP2PAtomicCapabilities + __cuDeviceGetP2PAtomicCapabilities = windll.GetProcAddress(handle, 'cuDeviceGetP2PAtomicCapabilities') {{endif}} {{if 'cuGraphicsUnregisterResource' in found_functions}} - try: - global __cuGraphicsUnregisterResource - __cuGraphicsUnregisterResource = win32api.GetProcAddress(handle, 'cuGraphicsUnregisterResource') - except: - pass + global __cuGraphicsUnregisterResource + __cuGraphicsUnregisterResource = windll.GetProcAddress(handle, 'cuGraphicsUnregisterResource') {{endif}} {{if 'cuGraphicsSubResourceGetMappedArray' in found_functions}} - try: - global __cuGraphicsSubResourceGetMappedArray - __cuGraphicsSubResourceGetMappedArray = win32api.GetProcAddress(handle, 'cuGraphicsSubResourceGetMappedArray') - except: - pass + global __cuGraphicsSubResourceGetMappedArray + __cuGraphicsSubResourceGetMappedArray = windll.GetProcAddress(handle, 'cuGraphicsSubResourceGetMappedArray') {{endif}} {{if 'cuGraphicsResourceGetMappedMipmappedArray' in found_functions}} - try: - global __cuGraphicsResourceGetMappedMipmappedArray - __cuGraphicsResourceGetMappedMipmappedArray = win32api.GetProcAddress(handle, 'cuGraphicsResourceGetMappedMipmappedArray') - except: - pass + global __cuGraphicsResourceGetMappedMipmappedArray + __cuGraphicsResourceGetMappedMipmappedArray = windll.GetProcAddress(handle, 'cuGraphicsResourceGetMappedMipmappedArray') {{endif}} {{if 'cuGraphicsResourceGetMappedPointer_v2' in found_functions}} - try: - global __cuGraphicsResourceGetMappedPointer_v2 - __cuGraphicsResourceGetMappedPointer_v2 = win32api.GetProcAddress(handle, 'cuGraphicsResourceGetMappedPointer_v2') - except: - pass + global __cuGraphicsResourceGetMappedPointer_v2 + __cuGraphicsResourceGetMappedPointer_v2 = windll.GetProcAddress(handle, 'cuGraphicsResourceGetMappedPointer_v2') {{endif}} {{if 'cuGraphicsResourceSetMapFlags_v2' in found_functions}} - try: - global __cuGraphicsResourceSetMapFlags_v2 - __cuGraphicsResourceSetMapFlags_v2 = win32api.GetProcAddress(handle, 'cuGraphicsResourceSetMapFlags_v2') - except: - pass + global __cuGraphicsResourceSetMapFlags_v2 + __cuGraphicsResourceSetMapFlags_v2 = windll.GetProcAddress(handle, 'cuGraphicsResourceSetMapFlags_v2') {{endif}} {{if 'cuGetProcAddress_v2' in found_functions}} - try: - global __cuGetProcAddress_v2 - __cuGetProcAddress_v2 = win32api.GetProcAddress(handle, 'cuGetProcAddress_v2') - except: - pass + global __cuGetProcAddress_v2 + __cuGetProcAddress_v2 = windll.GetProcAddress(handle, 'cuGetProcAddress_v2') {{endif}} {{if 'cuCoredumpGetAttribute' in found_functions}} - try: - global __cuCoredumpGetAttribute - __cuCoredumpGetAttribute = win32api.GetProcAddress(handle, 'cuCoredumpGetAttribute') - except: - pass + global __cuCoredumpGetAttribute + __cuCoredumpGetAttribute = windll.GetProcAddress(handle, 'cuCoredumpGetAttribute') {{endif}} {{if 'cuCoredumpGetAttributeGlobal' in found_functions}} - try: - global __cuCoredumpGetAttributeGlobal - __cuCoredumpGetAttributeGlobal = win32api.GetProcAddress(handle, 'cuCoredumpGetAttributeGlobal') - except: - pass + global __cuCoredumpGetAttributeGlobal + __cuCoredumpGetAttributeGlobal = windll.GetProcAddress(handle, 'cuCoredumpGetAttributeGlobal') {{endif}} {{if 'cuCoredumpSetAttribute' in found_functions}} - try: - global __cuCoredumpSetAttribute - __cuCoredumpSetAttribute = win32api.GetProcAddress(handle, 'cuCoredumpSetAttribute') - except: - pass + global __cuCoredumpSetAttribute + __cuCoredumpSetAttribute = windll.GetProcAddress(handle, 'cuCoredumpSetAttribute') {{endif}} {{if 'cuCoredumpSetAttributeGlobal' in found_functions}} - try: - global __cuCoredumpSetAttributeGlobal - __cuCoredumpSetAttributeGlobal = win32api.GetProcAddress(handle, 'cuCoredumpSetAttributeGlobal') - except: - pass + global __cuCoredumpSetAttributeGlobal + __cuCoredumpSetAttributeGlobal = windll.GetProcAddress(handle, 'cuCoredumpSetAttributeGlobal') {{endif}} {{if 'cuGetExportTable' in found_functions}} - try: - global __cuGetExportTable - __cuGetExportTable = win32api.GetProcAddress(handle, 'cuGetExportTable') - except: - pass + global __cuGetExportTable + __cuGetExportTable = windll.GetProcAddress(handle, 'cuGetExportTable') {{endif}} {{if 'cuGreenCtxCreate' in found_functions}} - try: - global __cuGreenCtxCreate - __cuGreenCtxCreate = win32api.GetProcAddress(handle, 'cuGreenCtxCreate') - except: - pass + global __cuGreenCtxCreate + __cuGreenCtxCreate = windll.GetProcAddress(handle, 'cuGreenCtxCreate') {{endif}} {{if 'cuGreenCtxDestroy' in found_functions}} - try: - global __cuGreenCtxDestroy - __cuGreenCtxDestroy = win32api.GetProcAddress(handle, 'cuGreenCtxDestroy') - except: - pass + global __cuGreenCtxDestroy + __cuGreenCtxDestroy = windll.GetProcAddress(handle, 'cuGreenCtxDestroy') {{endif}} {{if 'cuCtxFromGreenCtx' in found_functions}} - try: - global __cuCtxFromGreenCtx - __cuCtxFromGreenCtx = win32api.GetProcAddress(handle, 'cuCtxFromGreenCtx') - except: - pass + global __cuCtxFromGreenCtx + __cuCtxFromGreenCtx = windll.GetProcAddress(handle, 'cuCtxFromGreenCtx') {{endif}} {{if 'cuDeviceGetDevResource' in found_functions}} - try: - global __cuDeviceGetDevResource - __cuDeviceGetDevResource = win32api.GetProcAddress(handle, 'cuDeviceGetDevResource') - except: - pass + global __cuDeviceGetDevResource + __cuDeviceGetDevResource = windll.GetProcAddress(handle, 'cuDeviceGetDevResource') {{endif}} {{if 'cuCtxGetDevResource' in found_functions}} - try: - global __cuCtxGetDevResource - __cuCtxGetDevResource = win32api.GetProcAddress(handle, 'cuCtxGetDevResource') - except: - pass + global __cuCtxGetDevResource + __cuCtxGetDevResource = windll.GetProcAddress(handle, 'cuCtxGetDevResource') {{endif}} {{if 'cuGreenCtxGetDevResource' in found_functions}} - try: - global __cuGreenCtxGetDevResource - __cuGreenCtxGetDevResource = win32api.GetProcAddress(handle, 'cuGreenCtxGetDevResource') - except: - pass + global __cuGreenCtxGetDevResource + __cuGreenCtxGetDevResource = windll.GetProcAddress(handle, 'cuGreenCtxGetDevResource') {{endif}} {{if 'cuDevSmResourceSplitByCount' in found_functions}} - try: - global __cuDevSmResourceSplitByCount - __cuDevSmResourceSplitByCount = win32api.GetProcAddress(handle, 'cuDevSmResourceSplitByCount') - except: - pass + global __cuDevSmResourceSplitByCount + __cuDevSmResourceSplitByCount = windll.GetProcAddress(handle, 'cuDevSmResourceSplitByCount') {{endif}} {{if 'cuDevResourceGenerateDesc' in found_functions}} - try: - global __cuDevResourceGenerateDesc - __cuDevResourceGenerateDesc = win32api.GetProcAddress(handle, 'cuDevResourceGenerateDesc') - except: - pass + global __cuDevResourceGenerateDesc + __cuDevResourceGenerateDesc = windll.GetProcAddress(handle, 'cuDevResourceGenerateDesc') {{endif}} {{if 'cuGreenCtxRecordEvent' in found_functions}} - try: - global __cuGreenCtxRecordEvent - __cuGreenCtxRecordEvent = win32api.GetProcAddress(handle, 'cuGreenCtxRecordEvent') - except: - pass + global __cuGreenCtxRecordEvent + __cuGreenCtxRecordEvent = windll.GetProcAddress(handle, 'cuGreenCtxRecordEvent') {{endif}} {{if 'cuGreenCtxWaitEvent' in found_functions}} - try: - global __cuGreenCtxWaitEvent - __cuGreenCtxWaitEvent = win32api.GetProcAddress(handle, 'cuGreenCtxWaitEvent') - except: - pass + global __cuGreenCtxWaitEvent + __cuGreenCtxWaitEvent = windll.GetProcAddress(handle, 'cuGreenCtxWaitEvent') {{endif}} {{if 'cuStreamGetGreenCtx' in found_functions}} - try: - global __cuStreamGetGreenCtx - __cuStreamGetGreenCtx = win32api.GetProcAddress(handle, 'cuStreamGetGreenCtx') - except: - pass + global __cuStreamGetGreenCtx + __cuStreamGetGreenCtx = windll.GetProcAddress(handle, 'cuStreamGetGreenCtx') {{endif}} {{if 'cuGreenCtxStreamCreate' in found_functions}} - try: - global __cuGreenCtxStreamCreate - __cuGreenCtxStreamCreate = win32api.GetProcAddress(handle, 'cuGreenCtxStreamCreate') - except: - pass + global __cuGreenCtxStreamCreate + __cuGreenCtxStreamCreate = windll.GetProcAddress(handle, 'cuGreenCtxStreamCreate') {{endif}} {{if 'cuGreenCtxGetId' in found_functions}} - try: - global __cuGreenCtxGetId - __cuGreenCtxGetId = win32api.GetProcAddress(handle, 'cuGreenCtxGetId') - except: - pass + global __cuGreenCtxGetId + __cuGreenCtxGetId = windll.GetProcAddress(handle, 'cuGreenCtxGetId') {{endif}} {{if 'cuLogsRegisterCallback' in found_functions}} - try: - global __cuLogsRegisterCallback - __cuLogsRegisterCallback = win32api.GetProcAddress(handle, 'cuLogsRegisterCallback') - except: - pass + global __cuLogsRegisterCallback + __cuLogsRegisterCallback = windll.GetProcAddress(handle, 'cuLogsRegisterCallback') {{endif}} {{if 'cuLogsUnregisterCallback' in found_functions}} - try: - global __cuLogsUnregisterCallback - __cuLogsUnregisterCallback = win32api.GetProcAddress(handle, 'cuLogsUnregisterCallback') - except: - pass + global __cuLogsUnregisterCallback + __cuLogsUnregisterCallback = windll.GetProcAddress(handle, 'cuLogsUnregisterCallback') {{endif}} {{if 'cuLogsCurrent' in found_functions}} - try: - global __cuLogsCurrent - __cuLogsCurrent = win32api.GetProcAddress(handle, 'cuLogsCurrent') - except: - pass + global __cuLogsCurrent + __cuLogsCurrent = windll.GetProcAddress(handle, 'cuLogsCurrent') {{endif}} {{if 'cuLogsDumpToFile' in found_functions}} - try: - global __cuLogsDumpToFile - __cuLogsDumpToFile = win32api.GetProcAddress(handle, 'cuLogsDumpToFile') - except: - pass + global __cuLogsDumpToFile + __cuLogsDumpToFile = windll.GetProcAddress(handle, 'cuLogsDumpToFile') {{endif}} {{if 'cuLogsDumpToMemory' in found_functions}} - try: - global __cuLogsDumpToMemory - __cuLogsDumpToMemory = win32api.GetProcAddress(handle, 'cuLogsDumpToMemory') - except: - pass + global __cuLogsDumpToMemory + __cuLogsDumpToMemory = windll.GetProcAddress(handle, 'cuLogsDumpToMemory') {{endif}} {{if 'cuCheckpointProcessGetRestoreThreadId' in found_functions}} - try: - global __cuCheckpointProcessGetRestoreThreadId - __cuCheckpointProcessGetRestoreThreadId = win32api.GetProcAddress(handle, 'cuCheckpointProcessGetRestoreThreadId') - except: - pass + global __cuCheckpointProcessGetRestoreThreadId + __cuCheckpointProcessGetRestoreThreadId = windll.GetProcAddress(handle, 'cuCheckpointProcessGetRestoreThreadId') {{endif}} {{if 'cuCheckpointProcessGetState' in found_functions}} - try: - global __cuCheckpointProcessGetState - __cuCheckpointProcessGetState = win32api.GetProcAddress(handle, 'cuCheckpointProcessGetState') - except: - pass + global __cuCheckpointProcessGetState + __cuCheckpointProcessGetState = windll.GetProcAddress(handle, 'cuCheckpointProcessGetState') {{endif}} {{if 'cuCheckpointProcessLock' in found_functions}} - try: - global __cuCheckpointProcessLock - __cuCheckpointProcessLock = win32api.GetProcAddress(handle, 'cuCheckpointProcessLock') - except: - pass + global __cuCheckpointProcessLock + __cuCheckpointProcessLock = windll.GetProcAddress(handle, 'cuCheckpointProcessLock') {{endif}} {{if 'cuCheckpointProcessCheckpoint' in found_functions}} - try: - global __cuCheckpointProcessCheckpoint - __cuCheckpointProcessCheckpoint = win32api.GetProcAddress(handle, 'cuCheckpointProcessCheckpoint') - except: - pass + global __cuCheckpointProcessCheckpoint + __cuCheckpointProcessCheckpoint = windll.GetProcAddress(handle, 'cuCheckpointProcessCheckpoint') {{endif}} {{if 'cuCheckpointProcessUnlock' in found_functions}} - try: - global __cuCheckpointProcessUnlock - __cuCheckpointProcessUnlock = win32api.GetProcAddress(handle, 'cuCheckpointProcessUnlock') - except: - pass + global __cuCheckpointProcessUnlock + __cuCheckpointProcessUnlock = windll.GetProcAddress(handle, 'cuCheckpointProcessUnlock') {{endif}} {{if 'cuProfilerStart' in found_functions}} - try: - global __cuProfilerStart - __cuProfilerStart = win32api.GetProcAddress(handle, 'cuProfilerStart') - except: - pass + global __cuProfilerStart + __cuProfilerStart = windll.GetProcAddress(handle, 'cuProfilerStart') {{endif}} {{if 'cuProfilerStop' in found_functions}} - try: - global __cuProfilerStop - __cuProfilerStop = win32api.GetProcAddress(handle, 'cuProfilerStop') - except: - pass + global __cuProfilerStop + __cuProfilerStop = windll.GetProcAddress(handle, 'cuProfilerStop') {{endif}} {{if True}} - try: - global __cuGraphicsEGLRegisterImage - __cuGraphicsEGLRegisterImage = win32api.GetProcAddress(handle, 'cuGraphicsEGLRegisterImage') - except: - pass + global __cuGraphicsEGLRegisterImage + __cuGraphicsEGLRegisterImage = windll.GetProcAddress(handle, 'cuGraphicsEGLRegisterImage') {{endif}} {{if True}} - try: - global __cuEGLStreamConsumerConnect - __cuEGLStreamConsumerConnect = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerConnect') - except: - pass + global __cuEGLStreamConsumerConnect + __cuEGLStreamConsumerConnect = windll.GetProcAddress(handle, 'cuEGLStreamConsumerConnect') {{endif}} {{if True}} - try: - global __cuEGLStreamConsumerConnectWithFlags - __cuEGLStreamConsumerConnectWithFlags = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerConnectWithFlags') - except: - pass + global __cuEGLStreamConsumerConnectWithFlags + __cuEGLStreamConsumerConnectWithFlags = windll.GetProcAddress(handle, 'cuEGLStreamConsumerConnectWithFlags') {{endif}} {{if True}} - try: - global __cuEGLStreamConsumerDisconnect - __cuEGLStreamConsumerDisconnect = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerDisconnect') - except: - pass + global __cuEGLStreamConsumerDisconnect + __cuEGLStreamConsumerDisconnect = windll.GetProcAddress(handle, 'cuEGLStreamConsumerDisconnect') {{endif}} {{if True}} - try: - global __cuEGLStreamConsumerAcquireFrame - __cuEGLStreamConsumerAcquireFrame = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerAcquireFrame') - except: - pass + global __cuEGLStreamConsumerAcquireFrame + __cuEGLStreamConsumerAcquireFrame = windll.GetProcAddress(handle, 'cuEGLStreamConsumerAcquireFrame') {{endif}} {{if True}} - try: - global __cuEGLStreamConsumerReleaseFrame - __cuEGLStreamConsumerReleaseFrame = win32api.GetProcAddress(handle, 'cuEGLStreamConsumerReleaseFrame') - except: - pass + global __cuEGLStreamConsumerReleaseFrame + __cuEGLStreamConsumerReleaseFrame = windll.GetProcAddress(handle, 'cuEGLStreamConsumerReleaseFrame') {{endif}} {{if True}} - try: - global __cuEGLStreamProducerConnect - __cuEGLStreamProducerConnect = win32api.GetProcAddress(handle, 'cuEGLStreamProducerConnect') - except: - pass + global __cuEGLStreamProducerConnect + __cuEGLStreamProducerConnect = windll.GetProcAddress(handle, 'cuEGLStreamProducerConnect') {{endif}} {{if True}} - try: - global __cuEGLStreamProducerDisconnect - __cuEGLStreamProducerDisconnect = win32api.GetProcAddress(handle, 'cuEGLStreamProducerDisconnect') - except: - pass + global __cuEGLStreamProducerDisconnect + __cuEGLStreamProducerDisconnect = windll.GetProcAddress(handle, 'cuEGLStreamProducerDisconnect') {{endif}} {{if True}} - try: - global __cuEGLStreamProducerPresentFrame - __cuEGLStreamProducerPresentFrame = win32api.GetProcAddress(handle, 'cuEGLStreamProducerPresentFrame') - except: - pass + global __cuEGLStreamProducerPresentFrame + __cuEGLStreamProducerPresentFrame = windll.GetProcAddress(handle, 'cuEGLStreamProducerPresentFrame') {{endif}} {{if True}} - try: - global __cuEGLStreamProducerReturnFrame - __cuEGLStreamProducerReturnFrame = win32api.GetProcAddress(handle, 'cuEGLStreamProducerReturnFrame') - except: - pass + global __cuEGLStreamProducerReturnFrame + __cuEGLStreamProducerReturnFrame = windll.GetProcAddress(handle, 'cuEGLStreamProducerReturnFrame') {{endif}} {{if True}} - try: - global __cuGraphicsResourceGetMappedEglFrame - __cuGraphicsResourceGetMappedEglFrame = win32api.GetProcAddress(handle, 'cuGraphicsResourceGetMappedEglFrame') - except: - pass + global __cuGraphicsResourceGetMappedEglFrame + __cuGraphicsResourceGetMappedEglFrame = windll.GetProcAddress(handle, 'cuGraphicsResourceGetMappedEglFrame') {{endif}} {{if True}} - try: - global __cuEventCreateFromEGLSync - __cuEventCreateFromEGLSync = win32api.GetProcAddress(handle, 'cuEventCreateFromEGLSync') - except: - pass + global __cuEventCreateFromEGLSync + __cuEventCreateFromEGLSync = windll.GetProcAddress(handle, 'cuEventCreateFromEGLSync') {{endif}} {{if True}} - try: - global __cuGraphicsGLRegisterBuffer - __cuGraphicsGLRegisterBuffer = win32api.GetProcAddress(handle, 'cuGraphicsGLRegisterBuffer') - except: - pass + global __cuGraphicsGLRegisterBuffer + __cuGraphicsGLRegisterBuffer = windll.GetProcAddress(handle, 'cuGraphicsGLRegisterBuffer') {{endif}} {{if True}} - try: - global __cuGraphicsGLRegisterImage - __cuGraphicsGLRegisterImage = win32api.GetProcAddress(handle, 'cuGraphicsGLRegisterImage') - except: - pass + global __cuGraphicsGLRegisterImage + __cuGraphicsGLRegisterImage = windll.GetProcAddress(handle, 'cuGraphicsGLRegisterImage') {{endif}} {{if True}} - try: - global __cuGLGetDevices_v2 - __cuGLGetDevices_v2 = win32api.GetProcAddress(handle, 'cuGLGetDevices_v2') - except: - pass + global __cuGLGetDevices_v2 + __cuGLGetDevices_v2 = windll.GetProcAddress(handle, 'cuGLGetDevices_v2') {{endif}} {{if True}} - try: - global __cuVDPAUGetDevice - __cuVDPAUGetDevice = win32api.GetProcAddress(handle, 'cuVDPAUGetDevice') - except: - pass + global __cuVDPAUGetDevice + __cuVDPAUGetDevice = windll.GetProcAddress(handle, 'cuVDPAUGetDevice') {{endif}} {{if True}} - try: - global __cuVDPAUCtxCreate_v2 - __cuVDPAUCtxCreate_v2 = win32api.GetProcAddress(handle, 'cuVDPAUCtxCreate_v2') - except: - pass + global __cuVDPAUCtxCreate_v2 + __cuVDPAUCtxCreate_v2 = windll.GetProcAddress(handle, 'cuVDPAUCtxCreate_v2') {{endif}} {{if True}} - try: - global __cuGraphicsVDPAURegisterVideoSurface - __cuGraphicsVDPAURegisterVideoSurface = win32api.GetProcAddress(handle, 'cuGraphicsVDPAURegisterVideoSurface') - except: - pass + global __cuGraphicsVDPAURegisterVideoSurface + __cuGraphicsVDPAURegisterVideoSurface = windll.GetProcAddress(handle, 'cuGraphicsVDPAURegisterVideoSurface') {{endif}} {{if True}} - try: - global __cuGraphicsVDPAURegisterOutputSurface - __cuGraphicsVDPAURegisterOutputSurface = win32api.GetProcAddress(handle, 'cuGraphicsVDPAURegisterOutputSurface') - except: - pass + global __cuGraphicsVDPAURegisterOutputSurface + __cuGraphicsVDPAURegisterOutputSurface = windll.GetProcAddress(handle, 'cuGraphicsVDPAURegisterOutputSurface') {{endif}} {{else}} # Load using dlsym diff --git a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in index 229687a858..8409032852 100644 --- a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in +++ b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in @@ -4,13 +4,12 @@ # This code was automatically generated with version 13.0.0. Do not modify it directly. {{if 'Windows' == platform.system()}} import os -import win32api +cimport cuda.bindings._lib.windll as windll {{else}} cimport cuda.bindings._lib.dlfcn as dlfcn -from libc.stdint cimport uintptr_t {{endif}} from cuda.pathfinder import load_nvidia_dynamic_lib -from libc.stdint cimport intptr_t +from libc.stdint cimport intptr_t, uintptr_t import threading cdef object __symbol_lock = threading.Lock() @@ -50,172 +49,100 @@ cdef int _cuPythonInit() except -1 nogil: # Load function {{if 'nvrtcGetErrorString' in found_functions}} - try: - global __nvrtcGetErrorString - __nvrtcGetErrorString = win32api.GetProcAddress(handle, 'nvrtcGetErrorString') - except: - pass + global __nvrtcGetErrorString + __nvrtcGetErrorString = windll.GetProcAddress(handle, 'nvrtcGetErrorString') {{endif}} {{if 'nvrtcVersion' in found_functions}} - try: - global __nvrtcVersion - __nvrtcVersion = win32api.GetProcAddress(handle, 'nvrtcVersion') - except: - pass + global __nvrtcVersion + __nvrtcVersion = windll.GetProcAddress(handle, 'nvrtcVersion') {{endif}} {{if 'nvrtcGetNumSupportedArchs' in found_functions}} - try: - global __nvrtcGetNumSupportedArchs - __nvrtcGetNumSupportedArchs = win32api.GetProcAddress(handle, 'nvrtcGetNumSupportedArchs') - except: - pass + global __nvrtcGetNumSupportedArchs + __nvrtcGetNumSupportedArchs = windll.GetProcAddress(handle, 'nvrtcGetNumSupportedArchs') {{endif}} {{if 'nvrtcGetSupportedArchs' in found_functions}} - try: - global __nvrtcGetSupportedArchs - __nvrtcGetSupportedArchs = win32api.GetProcAddress(handle, 'nvrtcGetSupportedArchs') - except: - pass + global __nvrtcGetSupportedArchs + __nvrtcGetSupportedArchs = windll.GetProcAddress(handle, 'nvrtcGetSupportedArchs') {{endif}} {{if 'nvrtcCreateProgram' in found_functions}} - try: - global __nvrtcCreateProgram - __nvrtcCreateProgram = win32api.GetProcAddress(handle, 'nvrtcCreateProgram') - except: - pass + global __nvrtcCreateProgram + __nvrtcCreateProgram = windll.GetProcAddress(handle, 'nvrtcCreateProgram') {{endif}} {{if 'nvrtcDestroyProgram' in found_functions}} - try: - global __nvrtcDestroyProgram - __nvrtcDestroyProgram = win32api.GetProcAddress(handle, 'nvrtcDestroyProgram') - except: - pass + global __nvrtcDestroyProgram + __nvrtcDestroyProgram = windll.GetProcAddress(handle, 'nvrtcDestroyProgram') {{endif}} {{if 'nvrtcCompileProgram' in found_functions}} - try: - global __nvrtcCompileProgram - __nvrtcCompileProgram = win32api.GetProcAddress(handle, 'nvrtcCompileProgram') - except: - pass + global __nvrtcCompileProgram + __nvrtcCompileProgram = windll.GetProcAddress(handle, 'nvrtcCompileProgram') {{endif}} {{if 'nvrtcGetPTXSize' in found_functions}} - try: - global __nvrtcGetPTXSize - __nvrtcGetPTXSize = win32api.GetProcAddress(handle, 'nvrtcGetPTXSize') - except: - pass + global __nvrtcGetPTXSize + __nvrtcGetPTXSize = windll.GetProcAddress(handle, 'nvrtcGetPTXSize') {{endif}} {{if 'nvrtcGetPTX' in found_functions}} - try: - global __nvrtcGetPTX - __nvrtcGetPTX = win32api.GetProcAddress(handle, 'nvrtcGetPTX') - except: - pass + global __nvrtcGetPTX + __nvrtcGetPTX = windll.GetProcAddress(handle, 'nvrtcGetPTX') {{endif}} {{if 'nvrtcGetCUBINSize' in found_functions}} - try: - global __nvrtcGetCUBINSize - __nvrtcGetCUBINSize = win32api.GetProcAddress(handle, 'nvrtcGetCUBINSize') - except: - pass + global __nvrtcGetCUBINSize + __nvrtcGetCUBINSize = windll.GetProcAddress(handle, 'nvrtcGetCUBINSize') {{endif}} {{if 'nvrtcGetCUBIN' in found_functions}} - try: - global __nvrtcGetCUBIN - __nvrtcGetCUBIN = win32api.GetProcAddress(handle, 'nvrtcGetCUBIN') - except: - pass + global __nvrtcGetCUBIN + __nvrtcGetCUBIN = windll.GetProcAddress(handle, 'nvrtcGetCUBIN') {{endif}} {{if 'nvrtcGetLTOIRSize' in found_functions}} - try: - global __nvrtcGetLTOIRSize - __nvrtcGetLTOIRSize = win32api.GetProcAddress(handle, 'nvrtcGetLTOIRSize') - except: - pass + global __nvrtcGetLTOIRSize + __nvrtcGetLTOIRSize = windll.GetProcAddress(handle, 'nvrtcGetLTOIRSize') {{endif}} {{if 'nvrtcGetLTOIR' in found_functions}} - try: - global __nvrtcGetLTOIR - __nvrtcGetLTOIR = win32api.GetProcAddress(handle, 'nvrtcGetLTOIR') - except: - pass + global __nvrtcGetLTOIR + __nvrtcGetLTOIR = windll.GetProcAddress(handle, 'nvrtcGetLTOIR') {{endif}} {{if 'nvrtcGetOptiXIRSize' in found_functions}} - try: - global __nvrtcGetOptiXIRSize - __nvrtcGetOptiXIRSize = win32api.GetProcAddress(handle, 'nvrtcGetOptiXIRSize') - except: - pass + global __nvrtcGetOptiXIRSize + __nvrtcGetOptiXIRSize = windll.GetProcAddress(handle, 'nvrtcGetOptiXIRSize') {{endif}} {{if 'nvrtcGetOptiXIR' in found_functions}} - try: - global __nvrtcGetOptiXIR - __nvrtcGetOptiXIR = win32api.GetProcAddress(handle, 'nvrtcGetOptiXIR') - except: - pass + global __nvrtcGetOptiXIR + __nvrtcGetOptiXIR = windll.GetProcAddress(handle, 'nvrtcGetOptiXIR') {{endif}} {{if 'nvrtcGetProgramLogSize' in found_functions}} - try: - global __nvrtcGetProgramLogSize - __nvrtcGetProgramLogSize = win32api.GetProcAddress(handle, 'nvrtcGetProgramLogSize') - except: - pass + global __nvrtcGetProgramLogSize + __nvrtcGetProgramLogSize = windll.GetProcAddress(handle, 'nvrtcGetProgramLogSize') {{endif}} {{if 'nvrtcGetProgramLog' in found_functions}} - try: - global __nvrtcGetProgramLog - __nvrtcGetProgramLog = win32api.GetProcAddress(handle, 'nvrtcGetProgramLog') - except: - pass + global __nvrtcGetProgramLog + __nvrtcGetProgramLog = windll.GetProcAddress(handle, 'nvrtcGetProgramLog') {{endif}} {{if 'nvrtcAddNameExpression' in found_functions}} - try: - global __nvrtcAddNameExpression - __nvrtcAddNameExpression = win32api.GetProcAddress(handle, 'nvrtcAddNameExpression') - except: - pass + global __nvrtcAddNameExpression + __nvrtcAddNameExpression = windll.GetProcAddress(handle, 'nvrtcAddNameExpression') {{endif}} {{if 'nvrtcGetLoweredName' in found_functions}} - try: - global __nvrtcGetLoweredName - __nvrtcGetLoweredName = win32api.GetProcAddress(handle, 'nvrtcGetLoweredName') - except: - pass + global __nvrtcGetLoweredName + __nvrtcGetLoweredName = windll.GetProcAddress(handle, 'nvrtcGetLoweredName') {{endif}} {{if 'nvrtcGetPCHHeapSize' in found_functions}} - try: - global __nvrtcGetPCHHeapSize - __nvrtcGetPCHHeapSize = win32api.GetProcAddress(handle, 'nvrtcGetPCHHeapSize') - except: - pass + global __nvrtcGetPCHHeapSize + __nvrtcGetPCHHeapSize = windll.GetProcAddress(handle, 'nvrtcGetPCHHeapSize') {{endif}} {{if 'nvrtcSetPCHHeapSize' in found_functions}} - try: - global __nvrtcSetPCHHeapSize - __nvrtcSetPCHHeapSize = win32api.GetProcAddress(handle, 'nvrtcSetPCHHeapSize') - except: - pass + global __nvrtcSetPCHHeapSize + __nvrtcSetPCHHeapSize = windll.GetProcAddress(handle, 'nvrtcSetPCHHeapSize') {{endif}} {{if 'nvrtcGetPCHCreateStatus' in found_functions}} - try: - global __nvrtcGetPCHCreateStatus - __nvrtcGetPCHCreateStatus = win32api.GetProcAddress(handle, 'nvrtcGetPCHCreateStatus') - except: - pass + global __nvrtcGetPCHCreateStatus + __nvrtcGetPCHCreateStatus = windll.GetProcAddress(handle, 'nvrtcGetPCHCreateStatus') {{endif}} {{if 'nvrtcGetPCHHeapSizeRequired' in found_functions}} - try: - global __nvrtcGetPCHHeapSizeRequired - __nvrtcGetPCHHeapSizeRequired = win32api.GetProcAddress(handle, 'nvrtcGetPCHHeapSizeRequired') - except: - pass + global __nvrtcGetPCHHeapSizeRequired + __nvrtcGetPCHHeapSizeRequired = windll.GetProcAddress(handle, 'nvrtcGetPCHHeapSizeRequired') {{endif}} {{if 'nvrtcSetFlowCallback' in found_functions}} - try: - global __nvrtcSetFlowCallback - __nvrtcSetFlowCallback = win32api.GetProcAddress(handle, 'nvrtcSetFlowCallback') - except: - pass + global __nvrtcSetFlowCallback + __nvrtcSetFlowCallback = windll.GetProcAddress(handle, 'nvrtcSetFlowCallback') {{endif}} {{else}} diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx index f641ae7066..ab6b506516 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx @@ -30,6 +30,24 @@ cdef extern from "" nogil: const void* RTLD_DEFAULT 'RTLD_DEFAULT' +cdef int get_cuda_version(): + cdef void* handle = NULL + cdef int err, driver_ver = 0 + + # Load driver to check version + handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL) + if handle == NULL: + err_msg = dlerror() + raise NotSupportedError(f'CUDA driver is not found ({err_msg.decode()})') + cuDriverGetVersion = dlsym(handle, "cuDriverGetVersion") + if cuDriverGetVersion == NULL: + raise RuntimeError('something went wrong') + err = (cuDriverGetVersion)(&driver_ver) + if err != 0: + raise RuntimeError('something went wrong') + + return driver_ver + ############################################################################### # Wrapper init @@ -37,7 +55,6 @@ cdef extern from "" nogil: cdef object __symbol_lock = threading.Lock() cdef bint __py_nvjitlink_init = False -cdef void* __cuDriverGetVersion = NULL cdef void* __nvJitLinkCreate = NULL cdef void* __nvJitLinkDestroy = NULL @@ -66,24 +83,9 @@ cdef int _check_or_init_nvjitlink() except -1 nogil: return 0 cdef void* handle = NULL - cdef int err, driver_ver = 0 with gil, __symbol_lock: - # Load driver to check version - handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL) - if handle == NULL: - err_msg = dlerror() - raise NotSupportedError(f'CUDA driver is not found ({err_msg.decode()})') - global __cuDriverGetVersion - if __cuDriverGetVersion == NULL: - __cuDriverGetVersion = dlsym(handle, "cuDriverGetVersion") - if __cuDriverGetVersion == NULL: - raise RuntimeError('something went wrong') - err = (__cuDriverGetVersion)(&driver_ver) - if err != 0: - raise RuntimeError('something went wrong') - #dlclose(handle) - handle = NULL + driver_ver = get_cuda_version() # Load function global __nvJitLinkCreate diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx index b2c0576166..627b3f829a 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx @@ -11,19 +11,68 @@ from .utils import FunctionNotFoundError, NotSupportedError from cuda.pathfinder import load_nvidia_dynamic_lib -import win32api +from libc.stddef cimport wchar_t +from libc.stdint cimport intptr_t, uintptr_t +from cpython cimport PyUnicode_AsWideCharString + +from .utils import NotSupportedError + +cdef extern from "windows.h": + ctypedef void* HMODULE + ctypedef void* HANDLE + ctypedef void* FARPROC + ctypedef unsigned long DWORD + ctypedef const wchar_t *LPCWSTR + + cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 + cdef DWORD LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000 + cdef DWORD LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x00000100 + + HMODULE _LoadLibraryExW "LoadLibraryExW"( + LPCWSTR lpLibFileName, + HANDLE hFile, + DWORD dwFlags + ) nogil + + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) nogil + +cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogil: + cdef wchar_t* wpath + with gil: + wpath = PyUnicode_AsWideCharString(path, NULL) + return _LoadLibraryExW( + wpath, + hFile, + dwFlags + ) + +cdef inline FARPROC GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: + return _GetProcAddress(hModule, lpProcName) + +cdef int get_cuda_version(): + cdef int err, driver_ver = 0 + + # Load driver to check version + handle = LoadLibraryExW("nvcuda.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32) + if handle == 0: + raise NotSupportedError('CUDA driver is not found') + cuDriverGetVersion = GetProcAddress(handle, 'cuDriverGetVersion') + if cuDriverGetVersion == NULL: + raise RuntimeError('something went wrong') + err = (cuDriverGetVersion)(&driver_ver) + if err != 0: + raise RuntimeError('something went wrong') + + return driver_ver + ############################################################################### # Wrapper init ############################################################################### -LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 -LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000 -LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x00000100 cdef object __symbol_lock = threading.Lock() cdef bint __py_nvjitlink_init = False -cdef void* __cuDriverGetVersion = NULL cdef void* __nvJitLinkCreate = NULL cdef void* __nvJitLinkDestroy = NULL @@ -46,110 +95,54 @@ cdef int _check_or_init_nvjitlink() except -1 nogil: if __py_nvjitlink_init: return 0 - cdef int err, driver_ver = 0 - with gil, __symbol_lock: - # Load driver to check version - try: - handle = win32api.LoadLibraryEx("nvcuda.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32) - except Exception as e: - raise NotSupportedError(f'CUDA driver is not found ({e})') - global __cuDriverGetVersion - if __cuDriverGetVersion == NULL: - __cuDriverGetVersion = win32api.GetProcAddress(handle, 'cuDriverGetVersion') - if __cuDriverGetVersion == NULL: - raise RuntimeError('something went wrong') - err = (__cuDriverGetVersion)(&driver_ver) - if err != 0: - raise RuntimeError('something went wrong') + driver_ver = get_cuda_version() # Load library handle = load_nvidia_dynamic_lib("nvJitLink")._handle_uint # Load function global __nvJitLinkCreate - try: - __nvJitLinkCreate = win32api.GetProcAddress(handle, 'nvJitLinkCreate') - except: - pass + __nvJitLinkCreate = GetProcAddress(handle, 'nvJitLinkCreate') global __nvJitLinkDestroy - try: - __nvJitLinkDestroy = win32api.GetProcAddress(handle, 'nvJitLinkDestroy') - except: - pass + __nvJitLinkDestroy = GetProcAddress(handle, 'nvJitLinkDestroy') global __nvJitLinkAddData - try: - __nvJitLinkAddData = win32api.GetProcAddress(handle, 'nvJitLinkAddData') - except: - pass + __nvJitLinkAddData = GetProcAddress(handle, 'nvJitLinkAddData') global __nvJitLinkAddFile - try: - __nvJitLinkAddFile = win32api.GetProcAddress(handle, 'nvJitLinkAddFile') - except: - pass + __nvJitLinkAddFile = GetProcAddress(handle, 'nvJitLinkAddFile') global __nvJitLinkComplete - try: - __nvJitLinkComplete = win32api.GetProcAddress(handle, 'nvJitLinkComplete') - except: - pass + __nvJitLinkComplete = GetProcAddress(handle, 'nvJitLinkComplete') global __nvJitLinkGetLinkedCubinSize - try: - __nvJitLinkGetLinkedCubinSize = win32api.GetProcAddress(handle, 'nvJitLinkGetLinkedCubinSize') - except: - pass + __nvJitLinkGetLinkedCubinSize = GetProcAddress(handle, 'nvJitLinkGetLinkedCubinSize') global __nvJitLinkGetLinkedCubin - try: - __nvJitLinkGetLinkedCubin = win32api.GetProcAddress(handle, 'nvJitLinkGetLinkedCubin') - except: - pass + __nvJitLinkGetLinkedCubin = GetProcAddress(handle, 'nvJitLinkGetLinkedCubin') global __nvJitLinkGetLinkedPtxSize - try: - __nvJitLinkGetLinkedPtxSize = win32api.GetProcAddress(handle, 'nvJitLinkGetLinkedPtxSize') - except: - pass + __nvJitLinkGetLinkedPtxSize = GetProcAddress(handle, 'nvJitLinkGetLinkedPtxSize') global __nvJitLinkGetLinkedPtx - try: - __nvJitLinkGetLinkedPtx = win32api.GetProcAddress(handle, 'nvJitLinkGetLinkedPtx') - except: - pass + __nvJitLinkGetLinkedPtx = GetProcAddress(handle, 'nvJitLinkGetLinkedPtx') global __nvJitLinkGetErrorLogSize - try: - __nvJitLinkGetErrorLogSize = win32api.GetProcAddress(handle, 'nvJitLinkGetErrorLogSize') - except: - pass + __nvJitLinkGetErrorLogSize = GetProcAddress(handle, 'nvJitLinkGetErrorLogSize') global __nvJitLinkGetErrorLog - try: - __nvJitLinkGetErrorLog = win32api.GetProcAddress(handle, 'nvJitLinkGetErrorLog') - except: - pass + __nvJitLinkGetErrorLog = GetProcAddress(handle, 'nvJitLinkGetErrorLog') global __nvJitLinkGetInfoLogSize - try: - __nvJitLinkGetInfoLogSize = win32api.GetProcAddress(handle, 'nvJitLinkGetInfoLogSize') - except: - pass + __nvJitLinkGetInfoLogSize = GetProcAddress(handle, 'nvJitLinkGetInfoLogSize') global __nvJitLinkGetInfoLog - try: - __nvJitLinkGetInfoLog = win32api.GetProcAddress(handle, 'nvJitLinkGetInfoLog') - except: - pass + __nvJitLinkGetInfoLog = GetProcAddress(handle, 'nvJitLinkGetInfoLog') global __nvJitLinkVersion - try: - __nvJitLinkVersion = win32api.GetProcAddress(handle, 'nvJitLinkVersion') - except: - pass + __nvJitLinkVersion = GetProcAddress(handle, 'nvJitLinkVersion') __py_nvjitlink_init = True return 0 diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx index c2c1dd2b08..350b55f302 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx @@ -30,6 +30,24 @@ cdef extern from "" nogil: const void* RTLD_DEFAULT 'RTLD_DEFAULT' +cdef int get_cuda_version(): + cdef void* handle = NULL + cdef int err, driver_ver = 0 + + # Load driver to check version + handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL) + if handle == NULL: + err_msg = dlerror() + raise NotSupportedError(f'CUDA driver is not found ({err_msg.decode()})') + cuDriverGetVersion = dlsym(handle, "cuDriverGetVersion") + if cuDriverGetVersion == NULL: + raise RuntimeError('something went wrong') + err = (cuDriverGetVersion)(&driver_ver) + if err != 0: + raise RuntimeError('something went wrong') + + return driver_ver + ############################################################################### # Wrapper init @@ -37,7 +55,6 @@ cdef extern from "" nogil: cdef object __symbol_lock = threading.Lock() cdef bint __py_nvvm_init = False -cdef void* __cuDriverGetVersion = NULL cdef void* __nvvmGetErrorString = NULL cdef void* __nvvmVersion = NULL @@ -65,24 +82,9 @@ cdef int _check_or_init_nvvm() except -1 nogil: return 0 cdef void* handle = NULL - cdef int err, driver_ver = 0 with gil, __symbol_lock: - # Load driver to check version - handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL) - if handle == NULL: - err_msg = dlerror() - raise NotSupportedError(f'CUDA driver is not found ({err_msg.decode()})') - global __cuDriverGetVersion - if __cuDriverGetVersion == NULL: - __cuDriverGetVersion = dlsym(handle, "cuDriverGetVersion") - if __cuDriverGetVersion == NULL: - raise RuntimeError('something went wrong') - err = (__cuDriverGetVersion)(&driver_ver) - if err != 0: - raise RuntimeError('something went wrong') - #dlclose(handle) - handle = NULL + driver_ver = get_cuda_version() # Load function global __nvvmGetErrorString diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx index 98870aa613..e827d0a05f 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx @@ -11,19 +11,68 @@ from .utils import FunctionNotFoundError, NotSupportedError from cuda.pathfinder import load_nvidia_dynamic_lib -import win32api +from libc.stddef cimport wchar_t +from libc.stdint cimport intptr_t, uintptr_t +from cpython cimport PyUnicode_AsWideCharString + +from .utils import NotSupportedError + +cdef extern from "windows.h": + ctypedef void* HMODULE + ctypedef void* HANDLE + ctypedef void* FARPROC + ctypedef unsigned long DWORD + ctypedef const wchar_t *LPCWSTR + + cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 + cdef DWORD LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000 + cdef DWORD LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x00000100 + + HMODULE _LoadLibraryExW "LoadLibraryExW"( + LPCWSTR lpLibFileName, + HANDLE hFile, + DWORD dwFlags + ) nogil + + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) nogil + +cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogil: + cdef wchar_t* wpath + with gil: + wpath = PyUnicode_AsWideCharString(path, NULL) + return _LoadLibraryExW( + wpath, + hFile, + dwFlags + ) + +cdef inline FARPROC GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: + return _GetProcAddress(hModule, lpProcName) + +cdef int get_cuda_version(): + cdef int err, driver_ver = 0 + + # Load driver to check version + handle = LoadLibraryExW("nvcuda.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32) + if handle == 0: + raise NotSupportedError('CUDA driver is not found') + cuDriverGetVersion = GetProcAddress(handle, 'cuDriverGetVersion') + if cuDriverGetVersion == NULL: + raise RuntimeError('something went wrong') + err = (cuDriverGetVersion)(&driver_ver) + if err != 0: + raise RuntimeError('something went wrong') + + return driver_ver + ############################################################################### # Wrapper init ############################################################################### -LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 -LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000 -LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x00000100 cdef object __symbol_lock = threading.Lock() cdef bint __py_nvvm_init = False -cdef void* __cuDriverGetVersion = NULL cdef void* __nvvmGetErrorString = NULL cdef void* __nvvmVersion = NULL @@ -45,104 +94,51 @@ cdef int _check_or_init_nvvm() except -1 nogil: if __py_nvvm_init: return 0 - cdef int err, driver_ver = 0 - with gil, __symbol_lock: - # Load driver to check version - try: - handle = win32api.LoadLibraryEx("nvcuda.dll", 0, LOAD_LIBRARY_SEARCH_SYSTEM32) - except Exception as e: - raise NotSupportedError(f'CUDA driver is not found ({e})') - global __cuDriverGetVersion - if __cuDriverGetVersion == NULL: - __cuDriverGetVersion = win32api.GetProcAddress(handle, 'cuDriverGetVersion') - if __cuDriverGetVersion == NULL: - raise RuntimeError('something went wrong') - err = (__cuDriverGetVersion)(&driver_ver) - if err != 0: - raise RuntimeError('something went wrong') + driver_ver = get_cuda_version() # Load library handle = load_nvidia_dynamic_lib("nvvm")._handle_uint # Load function global __nvvmGetErrorString - try: - __nvvmGetErrorString = win32api.GetProcAddress(handle, 'nvvmGetErrorString') - except: - pass + __nvvmGetErrorString = GetProcAddress(handle, 'nvvmGetErrorString') global __nvvmVersion - try: - __nvvmVersion = win32api.GetProcAddress(handle, 'nvvmVersion') - except: - pass + __nvvmVersion = GetProcAddress(handle, 'nvvmVersion') global __nvvmIRVersion - try: - __nvvmIRVersion = win32api.GetProcAddress(handle, 'nvvmIRVersion') - except: - pass + __nvvmIRVersion = GetProcAddress(handle, 'nvvmIRVersion') global __nvvmCreateProgram - try: - __nvvmCreateProgram = win32api.GetProcAddress(handle, 'nvvmCreateProgram') - except: - pass + __nvvmCreateProgram = GetProcAddress(handle, 'nvvmCreateProgram') global __nvvmDestroyProgram - try: - __nvvmDestroyProgram = win32api.GetProcAddress(handle, 'nvvmDestroyProgram') - except: - pass + __nvvmDestroyProgram = GetProcAddress(handle, 'nvvmDestroyProgram') global __nvvmAddModuleToProgram - try: - __nvvmAddModuleToProgram = win32api.GetProcAddress(handle, 'nvvmAddModuleToProgram') - except: - pass + __nvvmAddModuleToProgram = GetProcAddress(handle, 'nvvmAddModuleToProgram') global __nvvmLazyAddModuleToProgram - try: - __nvvmLazyAddModuleToProgram = win32api.GetProcAddress(handle, 'nvvmLazyAddModuleToProgram') - except: - pass + __nvvmLazyAddModuleToProgram = GetProcAddress(handle, 'nvvmLazyAddModuleToProgram') global __nvvmCompileProgram - try: - __nvvmCompileProgram = win32api.GetProcAddress(handle, 'nvvmCompileProgram') - except: - pass + __nvvmCompileProgram = GetProcAddress(handle, 'nvvmCompileProgram') global __nvvmVerifyProgram - try: - __nvvmVerifyProgram = win32api.GetProcAddress(handle, 'nvvmVerifyProgram') - except: - pass + __nvvmVerifyProgram = GetProcAddress(handle, 'nvvmVerifyProgram') global __nvvmGetCompiledResultSize - try: - __nvvmGetCompiledResultSize = win32api.GetProcAddress(handle, 'nvvmGetCompiledResultSize') - except: - pass + __nvvmGetCompiledResultSize = GetProcAddress(handle, 'nvvmGetCompiledResultSize') global __nvvmGetCompiledResult - try: - __nvvmGetCompiledResult = win32api.GetProcAddress(handle, 'nvvmGetCompiledResult') - except: - pass + __nvvmGetCompiledResult = GetProcAddress(handle, 'nvvmGetCompiledResult') global __nvvmGetProgramLogSize - try: - __nvvmGetProgramLogSize = win32api.GetProcAddress(handle, 'nvvmGetProgramLogSize') - except: - pass + __nvvmGetProgramLogSize = GetProcAddress(handle, 'nvvmGetProgramLogSize') global __nvvmGetProgramLog - try: - __nvvmGetProgramLog = win32api.GetProcAddress(handle, 'nvvmGetProgramLog') - except: - pass + __nvvmGetProgramLog = GetProcAddress(handle, 'nvvmGetProgramLog') __py_nvvm_init = True return 0 diff --git a/cuda_bindings/cuda/bindings/_lib/windll.pxd b/cuda_bindings/cuda/bindings/_lib/windll.pxd new file mode 100644 index 0000000000..25ffa67b62 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_lib/windll.pxd @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +from libc.stddef cimport wchar_t +from libc.stdint cimport uintptr_t +from cpython cimport PyUnicode_AsWideCharString + +cdef extern from "windows.h": + ctypedef void* HMODULE + ctypedef void* HANDLE + ctypedef void* FARPROC + ctypedef unsigned long DWORD + ctypedef const wchar_t *LPCWSTR + + cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 + + HMODULE _LoadLibraryExW "LoadLibraryExW"( + LPCWSTR lpLibFileName, + HANDLE hFile, + DWORD dwFlags + ) nogil + + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) nogil + +cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogil: + cdef wchar_t* wpath + with gil: + wpath = PyUnicode_AsWideCharString(path, NULL) + return _LoadLibraryExW( + wpath, + hFile, + dwFlags + ) + +cdef inline FARPROC GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: + return _GetProcAddress(hModule, lpProcName) diff --git a/cuda_bindings/docs/source/release/13.X.Y-notes.rst b/cuda_bindings/docs/source/release/13.X.Y-notes.rst index 0e0e82badd..bf286bdc67 100644 --- a/cuda_bindings/docs/source/release/13.X.Y-notes.rst +++ b/cuda_bindings/docs/source/release/13.X.Y-notes.rst @@ -17,6 +17,7 @@ Highlights * The ``[all]`` optional dependencies now use ``cuda-toolkit`` with appropriate extras instead of individual packages. The NVCC compiler is no longer automatically installed with ``pip install cuda-python[all]`` as it was previously included only to access the NVVM library, which now has its own dedicated wheel. Users who need the NVCC compiler should explicitly install it with ``pip install cuda-toolkit[nvcc]==X.Y`` with the appropriate version for their needs. * The Python overhead of calling functions in CUDA bindings in ``driver``, ``runtime`` and ``nvrtc`` has been reduced by approximately 30%. +* On Windows, the ``pywin32`` dependency has been removed. The necessary Windows API functions are now accessed directly. Known issues diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml index 6af49d1efa..36fa778d11 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -28,7 +28,6 @@ dynamic = [ ] dependencies = [ "cuda-pathfinder ~=1.1", - "pywin32; sys_platform == 'win32'", ] [project.optional-dependencies] From 8c7ea2ed61ad34ef7f633fa934f99b9d212616da Mon Sep 17 00:00:00 2001 From: Mike Droettboom Date: Thu, 4 Sep 2025 14:37:04 -0400 Subject: [PATCH 2/6] Address comments from PR --- .../bindings/_internal/nvjitlink_linux.pyx | 2 ++ .../bindings/_internal/nvjitlink_windows.pyx | 26 +++++++++++++++---- .../cuda/bindings/_internal/nvvm_linux.pyx | 2 ++ .../cuda/bindings/_internal/nvvm_windows.pyx | 26 +++++++++++++++---- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx index ab6b506516..8d873105b8 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx @@ -16,6 +16,8 @@ from cuda.pathfinder import load_nvidia_dynamic_lib # Extern ############################################################################### +from .utils import NotSupportedError + cdef extern from "" nogil: void* dlopen(const char*, int) char* dlerror() diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx index 627b3f829a..8b4b179016 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx @@ -12,12 +12,12 @@ from .utils import FunctionNotFoundError, NotSupportedError from cuda.pathfinder import load_nvidia_dynamic_lib from libc.stddef cimport wchar_t -from libc.stdint cimport intptr_t, uintptr_t +from libc.stdint cimport uintptr_t from cpython cimport PyUnicode_AsWideCharString from .utils import NotSupportedError -cdef extern from "windows.h": +cdef extern from "windows.h" nogil: ctypedef void* HMODULE ctypedef void* HANDLE ctypedef void* FARPROC @@ -32,9 +32,13 @@ cdef extern from "windows.h": LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags - ) nogil + ) + + HMODULE _LoadLibraryW "LoadLibraryW"(LPCWSTR lpLibFileName) + + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) - FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) nogil + HMODULE _GetModuleHandleW "GetModuleHandleW"(LPCWSTR lpModuleName) cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogil: cdef wchar_t* wpath @@ -46,9 +50,21 @@ cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogi dwFlags ) -cdef inline FARPROC GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: +cdef inline uintptr_t LoadLibraryW(str path) nogil: + cdef wchar_t* wpath + with gil: + wpath = PyUnicode_AsWideCharString(path, NULL) + return _LoadLibraryW(wpath) + +cdef inline void *GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: return _GetProcAddress(hModule, lpProcName) +cdef inline uintptr_t GetModuleHandleW(str path) nogil: + cdef wchar_t* wpath + with gil: + wpath = PyUnicode_AsWideCharString(path, NULL) + return _GetModuleHandleW(wpath) + cdef int get_cuda_version(): cdef int err, driver_ver = 0 diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx index 350b55f302..260d856c77 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx @@ -16,6 +16,8 @@ from cuda.pathfinder import load_nvidia_dynamic_lib # Extern ############################################################################### +from .utils import NotSupportedError + cdef extern from "" nogil: void* dlopen(const char*, int) char* dlerror() diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx index e827d0a05f..5e79d32803 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx @@ -12,12 +12,12 @@ from .utils import FunctionNotFoundError, NotSupportedError from cuda.pathfinder import load_nvidia_dynamic_lib from libc.stddef cimport wchar_t -from libc.stdint cimport intptr_t, uintptr_t +from libc.stdint cimport uintptr_t from cpython cimport PyUnicode_AsWideCharString from .utils import NotSupportedError -cdef extern from "windows.h": +cdef extern from "windows.h" nogil: ctypedef void* HMODULE ctypedef void* HANDLE ctypedef void* FARPROC @@ -32,9 +32,13 @@ cdef extern from "windows.h": LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags - ) nogil + ) + + HMODULE _LoadLibraryW "LoadLibraryW"(LPCWSTR lpLibFileName) + + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) - FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) nogil + HMODULE _GetModuleHandleW "GetModuleHandleW"(LPCWSTR lpModuleName) cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogil: cdef wchar_t* wpath @@ -46,9 +50,21 @@ cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogi dwFlags ) -cdef inline FARPROC GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: +cdef inline uintptr_t LoadLibraryW(str path) nogil: + cdef wchar_t* wpath + with gil: + wpath = PyUnicode_AsWideCharString(path, NULL) + return _LoadLibraryW(wpath) + +cdef inline void *GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: return _GetProcAddress(hModule, lpProcName) +cdef inline uintptr_t GetModuleHandleW(str path) nogil: + cdef wchar_t* wpath + with gil: + wpath = PyUnicode_AsWideCharString(path, NULL) + return _GetModuleHandleW(wpath) + cdef int get_cuda_version(): cdef int err, driver_ver = 0 From e0e868a78a9ff18292ae1962348c155fa874e419 Mon Sep 17 00:00:00 2001 From: Mike Droettboom Date: Fri, 5 Sep 2025 13:01:13 -0400 Subject: [PATCH 3/6] Address comments from PR --- .../cuda/bindings/_internal/cufile_linux.pyx | 38 ++++++++++--------- .../bindings/_internal/nvjitlink_windows.pyx | 27 +++++++------ .../cuda/bindings/_internal/nvvm_windows.pyx | 27 +++++++------ cuda_bindings/cuda/bindings/_lib/windll.pxd | 31 ++++++++------- 4 files changed, 71 insertions(+), 52 deletions(-) diff --git a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx index 528628b35b..6dbf4bc282 100644 --- a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx @@ -18,6 +18,8 @@ import cython # Extern ############################################################################### +from .utils import NotSupportedError + cdef extern from "" nogil: void* dlopen(const char*, int) char* dlerror() @@ -32,6 +34,24 @@ cdef extern from "" nogil: const void* RTLD_DEFAULT 'RTLD_DEFAULT' +cdef int get_cuda_version(): + cdef void* handle = NULL + cdef int err, driver_ver = 0 + + # Load driver to check version + handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL) + if handle == NULL: + err_msg = dlerror() + raise NotSupportedError(f'CUDA driver is not found ({err_msg.decode()})') + cuDriverGetVersion = dlsym(handle, "cuDriverGetVersion") + if cuDriverGetVersion == NULL: + raise RuntimeError('something went wrong') + err = (cuDriverGetVersion)(&driver_ver) + if err != 0: + raise RuntimeError('something went wrong') + + return driver_ver + ############################################################################### # Wrapper init @@ -39,7 +59,6 @@ cdef extern from "" nogil: cdef object __symbol_lock = threading.Lock() cdef bint __py_cufile_init = False -cdef void* __cuDriverGetVersion = NULL cdef void* __cuFileHandleRegister = NULL cdef void* __cuFileHandleDeregister = NULL @@ -97,24 +116,9 @@ cdef int _check_or_init_cufile() except -1 nogil: return 0 cdef void* handle = NULL - cdef int err, driver_ver = 0 with gil, __symbol_lock: - # Load driver to check version - handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL) - if handle == NULL: - err_msg = dlerror() - raise NotSupportedError(f'CUDA driver is not found ({err_msg.decode()})') - global __cuDriverGetVersion - if __cuDriverGetVersion == NULL: - __cuDriverGetVersion = dlsym(handle, "cuDriverGetVersion") - if __cuDriverGetVersion == NULL: - raise RuntimeError('something went wrong') - err = (__cuDriverGetVersion)(&driver_ver) - if err != 0: - raise RuntimeError('something went wrong') - #dlclose(handle) - handle = NULL + driver_ver = get_cuda_version() # Load function global __cuFileHandleRegister diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx index 8b4b179016..e468edcb7e 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx @@ -13,7 +13,7 @@ from cuda.pathfinder import load_nvidia_dynamic_lib from libc.stddef cimport wchar_t from libc.stdint cimport uintptr_t -from cpython cimport PyUnicode_AsWideCharString +from cpython cimport PyUnicode_AsWideCharString, PyMem_Free from .utils import NotSupportedError @@ -23,6 +23,7 @@ cdef extern from "windows.h" nogil: ctypedef void* FARPROC ctypedef unsigned long DWORD ctypedef const wchar_t *LPCWSTR + ctypedef const char *LPCSTR cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 cdef DWORD LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000 @@ -36,19 +37,23 @@ cdef extern from "windows.h" nogil: HMODULE _LoadLibraryW "LoadLibraryW"(LPCWSTR lpLibFileName) - FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, LPCSTR lpProcName) HMODULE _GetModuleHandleW "GetModuleHandleW"(LPCWSTR lpModuleName) -cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogil: - cdef wchar_t* wpath - with gil: - wpath = PyUnicode_AsWideCharString(path, NULL) - return _LoadLibraryExW( - wpath, - hFile, - dwFlags - ) +cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): + cdef uintptr_t result + cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) + if wpath == NULL: + raise + with nogil: + result = _LoadLibraryExW( + wpath, + hFile, + dwFlags + ) + PyMem_Free(wpath) + return result cdef inline uintptr_t LoadLibraryW(str path) nogil: cdef wchar_t* wpath diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx index 5e79d32803..8c1b48c3f7 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx @@ -13,7 +13,7 @@ from cuda.pathfinder import load_nvidia_dynamic_lib from libc.stddef cimport wchar_t from libc.stdint cimport uintptr_t -from cpython cimport PyUnicode_AsWideCharString +from cpython cimport PyUnicode_AsWideCharString, PyMem_Free from .utils import NotSupportedError @@ -23,6 +23,7 @@ cdef extern from "windows.h" nogil: ctypedef void* FARPROC ctypedef unsigned long DWORD ctypedef const wchar_t *LPCWSTR + ctypedef const char *LPCSTR cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 cdef DWORD LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000 @@ -36,19 +37,23 @@ cdef extern from "windows.h" nogil: HMODULE _LoadLibraryW "LoadLibraryW"(LPCWSTR lpLibFileName) - FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, LPCSTR lpProcName) HMODULE _GetModuleHandleW "GetModuleHandleW"(LPCWSTR lpModuleName) -cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogil: - cdef wchar_t* wpath - with gil: - wpath = PyUnicode_AsWideCharString(path, NULL) - return _LoadLibraryExW( - wpath, - hFile, - dwFlags - ) +cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): + cdef uintptr_t result + cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) + if wpath == NULL: + raise + with nogil: + result = _LoadLibraryExW( + wpath, + hFile, + dwFlags + ) + PyMem_Free(wpath) + return result cdef inline uintptr_t LoadLibraryW(str path) nogil: cdef wchar_t* wpath diff --git a/cuda_bindings/cuda/bindings/_lib/windll.pxd b/cuda_bindings/cuda/bindings/_lib/windll.pxd index 25ffa67b62..6ad19f269c 100644 --- a/cuda_bindings/cuda/bindings/_lib/windll.pxd +++ b/cuda_bindings/cuda/bindings/_lib/windll.pxd @@ -3,14 +3,15 @@ from libc.stddef cimport wchar_t from libc.stdint cimport uintptr_t -from cpython cimport PyUnicode_AsWideCharString +from cpython cimport PyUnicode_AsWideCharString, PyMem_Free -cdef extern from "windows.h": +cdef extern from "windows.h" nogil: ctypedef void* HMODULE ctypedef void* HANDLE ctypedef void* FARPROC ctypedef unsigned long DWORD ctypedef const wchar_t *LPCWSTR + ctypedef const char *LPCSTR cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 @@ -18,19 +19,23 @@ cdef extern from "windows.h": LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags - ) nogil + ) - FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, const char* lpProcName) nogil + FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, LPCSTR lpProcName) -cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags) nogil: - cdef wchar_t* wpath - with gil: - wpath = PyUnicode_AsWideCharString(path, NULL) - return _LoadLibraryExW( - wpath, - hFile, - dwFlags - ) +cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): + cdef uintptr_t result + cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) + if wpath is NULL: + raise + with nogil: + result = _LoadLibraryExW( + wpath, + hFile, + dwFlags + ) + PyMem_Free(wpath) + return result cdef inline FARPROC GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: return _GetProcAddress(hModule, lpProcName) From 7a46173277e3a4be79e32ee310b49cf819c849ce Mon Sep 17 00:00:00 2001 From: Mike Droettboom Date: Fri, 5 Sep 2025 13:04:09 -0400 Subject: [PATCH 4/6] Remove APIs --- .../bindings/_internal/nvjitlink_windows.pyx | 16 ---------------- .../cuda/bindings/_internal/nvvm_windows.pyx | 16 ---------------- 2 files changed, 32 deletions(-) diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx index e468edcb7e..fe2d703dca 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx @@ -35,12 +35,8 @@ cdef extern from "windows.h" nogil: DWORD dwFlags ) - HMODULE _LoadLibraryW "LoadLibraryW"(LPCWSTR lpLibFileName) - FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, LPCSTR lpProcName) - HMODULE _GetModuleHandleW "GetModuleHandleW"(LPCWSTR lpModuleName) - cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): cdef uintptr_t result cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) @@ -55,21 +51,9 @@ cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): PyMem_Free(wpath) return result -cdef inline uintptr_t LoadLibraryW(str path) nogil: - cdef wchar_t* wpath - with gil: - wpath = PyUnicode_AsWideCharString(path, NULL) - return _LoadLibraryW(wpath) - cdef inline void *GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: return _GetProcAddress(hModule, lpProcName) -cdef inline uintptr_t GetModuleHandleW(str path) nogil: - cdef wchar_t* wpath - with gil: - wpath = PyUnicode_AsWideCharString(path, NULL) - return _GetModuleHandleW(wpath) - cdef int get_cuda_version(): cdef int err, driver_ver = 0 diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx index 8c1b48c3f7..58dff6132f 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx @@ -35,12 +35,8 @@ cdef extern from "windows.h" nogil: DWORD dwFlags ) - HMODULE _LoadLibraryW "LoadLibraryW"(LPCWSTR lpLibFileName) - FARPROC _GetProcAddress "GetProcAddress"(HMODULE hModule, LPCSTR lpProcName) - HMODULE _GetModuleHandleW "GetModuleHandleW"(LPCWSTR lpModuleName) - cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): cdef uintptr_t result cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) @@ -55,21 +51,9 @@ cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): PyMem_Free(wpath) return result -cdef inline uintptr_t LoadLibraryW(str path) nogil: - cdef wchar_t* wpath - with gil: - wpath = PyUnicode_AsWideCharString(path, NULL) - return _LoadLibraryW(wpath) - cdef inline void *GetProcAddress(uintptr_t hModule, const char* lpProcName) nogil: return _GetProcAddress(hModule, lpProcName) -cdef inline uintptr_t GetModuleHandleW(str path) nogil: - cdef wchar_t* wpath - with gil: - wpath = PyUnicode_AsWideCharString(path, NULL) - return _GetModuleHandleW(wpath) - cdef int get_cuda_version(): cdef int err, driver_ver = 0 From 488bdc297af9cc63698e607d6e1a1423863a58b5 Mon Sep 17 00:00:00 2001 From: Mike Droettboom Date: Fri, 5 Sep 2025 15:08:05 -0400 Subject: [PATCH 5/6] Don't check return type --- cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx | 2 -- cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx | 2 -- cuda_bindings/cuda/bindings/_lib/windll.pxd | 2 -- 3 files changed, 6 deletions(-) diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx index fe2d703dca..67bebb5ef3 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_windows.pyx @@ -40,8 +40,6 @@ cdef extern from "windows.h" nogil: cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): cdef uintptr_t result cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) - if wpath == NULL: - raise with nogil: result = _LoadLibraryExW( wpath, diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx index 58dff6132f..da22cebe19 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx @@ -40,8 +40,6 @@ cdef extern from "windows.h" nogil: cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): cdef uintptr_t result cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) - if wpath == NULL: - raise with nogil: result = _LoadLibraryExW( wpath, diff --git a/cuda_bindings/cuda/bindings/_lib/windll.pxd b/cuda_bindings/cuda/bindings/_lib/windll.pxd index 6ad19f269c..e3f86285e0 100644 --- a/cuda_bindings/cuda/bindings/_lib/windll.pxd +++ b/cuda_bindings/cuda/bindings/_lib/windll.pxd @@ -26,8 +26,6 @@ cdef extern from "windows.h" nogil: cdef inline uintptr_t LoadLibraryExW(str path, HANDLE hFile, DWORD dwFlags): cdef uintptr_t result cdef wchar_t* wpath = PyUnicode_AsWideCharString(path, NULL) - if wpath is NULL: - raise with nogil: result = _LoadLibraryExW( wpath, From 673974c64956acc62295e56fef83da0a1384928a Mon Sep 17 00:00:00 2001 From: Mike Droettboom Date: Mon, 8 Sep 2025 08:51:57 -0400 Subject: [PATCH 6/6] Address comments in PR --- cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx | 2 -- cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx | 2 -- cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx | 2 -- 3 files changed, 6 deletions(-) diff --git a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx index 6dbf4bc282..931ca8c293 100644 --- a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx @@ -18,8 +18,6 @@ import cython # Extern ############################################################################### -from .utils import NotSupportedError - cdef extern from "" nogil: void* dlopen(const char*, int) char* dlerror() diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx index 8d873105b8..ab6b506516 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx @@ -16,8 +16,6 @@ from cuda.pathfinder import load_nvidia_dynamic_lib # Extern ############################################################################### -from .utils import NotSupportedError - cdef extern from "" nogil: void* dlopen(const char*, int) char* dlerror() diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx index 260d856c77..350b55f302 100644 --- a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx @@ -16,8 +16,6 @@ from cuda.pathfinder import load_nvidia_dynamic_lib # Extern ############################################################################### -from .utils import NotSupportedError - cdef extern from "" nogil: void* dlopen(const char*, int) char* dlerror()