|
2 | 2 | # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE |
3 | 3 |
|
4 | 4 | # This code was automatically generated with version 13.0.0. Do not modify it directly. |
5 | | -from libc.stdint cimport uintptr_t |
6 | 5 | cimport cuda.bindings._bindings.cyruntime as cyruntime |
7 | 6 | cimport cython |
8 | 7 |
|
9 | | -from cuda.pathfinder import load_nvidia_dynamic_lib |
10 | | -{{if 'Windows' == platform.system()}} |
11 | | -import win32api |
12 | | -{{else}} |
13 | | -cimport cuda.bindings._lib.dlfcn as dlfcn |
14 | | -{{endif}} |
15 | | - |
16 | 8 | {{if 'cudaDeviceReset' in found_functions}} |
17 | 9 |
|
18 | 10 | cdef cudaError_t cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: |
@@ -1893,23 +1885,36 @@ cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** r |
1893 | 1885 |
|
1894 | 1886 | {{if True}} |
1895 | 1887 |
|
| 1888 | +from libc.stdint cimport uintptr_t |
| 1889 | +from cuda.pathfinder import load_nvidia_dynamic_lib |
| 1890 | +{{if 'Windows' == platform.system()}} |
| 1891 | +cimport cuda.bindings._lib.windll as windll |
| 1892 | +{{else}} |
| 1893 | +cimport cuda.bindings._lib.dlfcn as dlfcn |
| 1894 | +{{endif}} |
| 1895 | + |
1896 | 1896 | cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: |
| 1897 | + |
| 1898 | + # Load |
1897 | 1899 | with gil: |
1898 | 1900 | lib = load_nvidia_dynamic_lib("cudart") |
1899 | | - handle = <void *><uintptr_t>(lib._handle_uint) |
| 1901 | + handle = <void *><uintptr_t>lib._handle_uint |
1900 | 1902 |
|
1901 | | - {{if 'Windows' == platform.system()}} |
1902 | | - __cudaRuntimeGetVersion = <void*><unsigned long long>win32api.GetProcAddress(<uintptr_t>handle, 'cudaRuntimeGetVersion') |
1903 | | - {{else}} |
1904 | | - __cudaRuntimeGetVersion = dlfcn.dlsym(handle, 'cudaRuntimeGetVersion') |
1905 | | - {{endif}} |
| 1903 | + {{if 'Windows' == platform.system()}} |
| 1904 | + __cudaRuntimeGetVersion = windll.GetProcAddress(handle, b'cudaRuntimeGetVersion') |
| 1905 | + {{else}} |
| 1906 | + __cudaRuntimeGetVersion = dlfcn.dlsym(handle, 'cudaRuntimeGetVersion') |
| 1907 | + {{endif}} |
1906 | 1908 |
|
1907 | | - if __cudaRuntimeGetVersion == NULL: |
| 1909 | + if __cudaRuntimeGetVersion == NULL: |
| 1910 | + with gil: |
1908 | 1911 | raise RuntimeError(f'Function "cudaRuntimeGetVersion" not found in {lib.abs_path}') |
1909 | 1912 |
|
| 1913 | + # Call |
1910 | 1914 | cdef cudaError_t err = cudaSuccess |
1911 | 1915 | err = (<cudaError_t (*)(int*) except ?cudaErrorCallRequiresNewerDriver nogil> __cudaRuntimeGetVersion)(runtimeVersion) |
1912 | 1916 |
|
| 1917 | + # Unload |
1913 | 1918 | {{if 'Windows' != platform.system()}} |
1914 | 1919 | dlfcn.dlclose(handle) |
1915 | 1920 | {{endif}} |
|
0 commit comments