cuda.bindings._v2.driver.occupancy_max_active_clusters#

cuda.bindings._v2.driver.occupancy_max_active_clusters(intptr_t func, config) → int#

Given the kernel function (func) and launch configuration (config), return the maximum number of clusters that could co-exist on the target device in *num_clusters.

If the function has required cluster size already set (see cudaFuncGetAttributes / cuFuncGetAttribute), 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 the API can also be used with context-less kernel CUkernel by querying the handle using library_get_kernel() and then passing it to the API by casting to CUfunction. Here, the context to use for calculations will either be taken from the specified stream config->hStream or the current context in case of NULL stream.

Parameters:
  • func (intptr_t) – Kernel function for which maximum number of clusters are calculated.

  • config (intptr_t) – Launch configuration for the given kernel function.

Returns:

Returned maximum number of clusters that could co-exist on

the target device.

Return type:

int

See also

cuOccupancyMaxActiveClusters