pub unsafe extern "C" fn cudaOccupancyMaxActiveClusters(
numClusters: *mut c_int,
func: *const c_void,
launchConfig: *const cudaLaunchConfig_t,
) -> cudaError_tExpand description
Given the kernel function (func) and launch configuration (config), return the maximum number of clusters that could co-exist on the target device in *numClusters.
If the function has required cluster size already set (see cudaFuncGetAttributes), the cluster size from config must either be unspecified or match the required size. Without required sizes, the cluster size must be specified in config, else the function will return an error.
Note that various attributes of the kernel function may affect occupancy calculation. Runtime environment may affect how the hardware schedules the clusters, so the calculated occupancy is not guaranteed to be achievable.
Note that this function may also return error codes from previous, asynchronous launches.
Note that this function may also return cudaError_t::CUDA_ERROR_NOT_INITIALIZED, cudaErrorInsufficientDriver or cudaError_t::CUDA_ERROR_NO_DEVICE if this call tries to initialize internal CUDA RT state.
Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback. cudaError_t::CUDA_ERROR_NOT_PERMITTED may, but is not guaranteed to, be returned as a diagnostic in such case.
Note: The API can also be used with a kernel cudaKernel_t by querying the handle using cudaLibraryGetKernel or cudaGetKernel and then passing it to the API by casting to void*. The symbol entryFuncAddr passed to cudaGetKernel should be a symbol that is registered with the same CUDA Runtime instance.
Note: Passing a symbol that belongs that belongs to a different runtime instance will result in undefined behavior. The only type that can be reliably passed to a different runtime instance is cudaKernel_t.
§Parameters
numClusters: Returned maximum number of clusters that could co-exist on the target device.func: Kernel function for which maximum number of clusters are calculated.
§Return value
cudaError_t::CUDA_SUCCESScudaErrorInvalidDeviceFunctioncudaError_t::CUDA_ERROR_INVALID_VALUEcudaError_t::CUDA_ERROR_INVALID_CLUSTER_SIZEcudaError_t::CUDA_ERROR_UNKNOWN
See also: cudaFuncGetAttributes, (C++, API), cuOccupancyMaxActiveClusters.