cuda.bindings._v2.driver.get_proc_address_v2#
- cuda.bindings._v2.driver.get_proc_address_v2(symbol, int cuda_version, uint64_t flags) tuple#
Returns the requested driver API function pointer.
Returns in
**pfnthe address of the CUDA driver function for the requested CUDA version and flags. The CUDA version is specified as (1000 * major + 10 * minor), so CUDA 11.2 should be specified as 11020. For a requested driver symbol, if the specified CUDA version is greater than or equal to the CUDA version in which the driver symbol was introduced, this API will return the function pointer to the corresponding versioned function. If the specified CUDA version is greater than the driver version, the API will returnCUDA_ERROR_INVALID_VALUE. The pointer returned by the API should be cast to a function pointer matching the requested driver function’s definition in the API header file. The function pointer typedef can be picked up from the corresponding typedefs header file. For example, cudaTypedefs.h consists of function pointer typedefs for driver APIs defined incuda.h. The API will returnCUDA_SUCCESSand set the returnedpfnto NULL if the requested driver function is not supported on the platform, no ABI compatible driver function exists for the specifiedcuda_versionor if the driver symbol is invalid. It will also set the optionalsymbol_statusto one of the values inCUdriverProcAddressQueryResultwith the following meanings:.CU_GET_PROC_ADDRESS_SUCCESS- The requested symbol was succesfully found based on input arguments andpfnis valid.CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND- The requested symbol was not found.CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT- The requested symbol was found but is not supported by cuda_version specified.
The requested flags can be:.
CU_GET_PROC_ADDRESS_DEFAULT: This is the default mode. This is equivalent toCU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAMif the code is compiled with –default-stream per-thread compilation flag or the macro CUDA_API_PER_THREAD_DEFAULT_STREAM is defined;CU_GET_PROC_ADDRESS_LEGACY_STREAMotherwise.CU_GET_PROC_ADDRESS_LEGACY_STREAM: This will enable the search for all driver symbols that match the requested driver symbol name except the corresponding per-thread versions.CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM: This will enable the search for all driver symbols that match the requested driver symbol name including the per-thread versions. If a per-thread version is not found, the API will return the legacy version of the driver function.
- Parameters:
symbol (bytes) – The base name of the driver API function to look for. As an example, for the driver API
cuMemAlloc_v2,symbolwould be cuMemAlloc andcuda_versionwould be the ABI compatible CUDA version for the _v2 variant.cuda_version (int) – The CUDA version to look for the requested driver symbol.
flags (uint64_t) – Flags to specify search options.
- Returns:
- intptr_t: Location to return the function pointer to the requested
driver function.
- int: Optional location to store the status of the search for
symbolbased oncuda_version. SeeCUdriverProcAddressQueryResultfor possible values.
- Return type:
A 2-tuple containing
See also
cuGetProcAddress_v2