cuda.bindings._v2.driver.occupancy_available_dynamic_smem_per_block#

cuda.bindings._v2.driver.occupancy_available_dynamic_smem_per_block(
intptr_t func,
int num_blocks,
int block_size,
) → size_t#

Returns dynamic shared memory available per block when launching num_blocks blocks on SM.

Returns in *dynamic_smem_size the maximum size of dynamic shared memory to allow num_blocks blocks per SM. 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 be the current context.

Parameters:
  • func (intptr_t) – Kernel function for which occupancy is calculated.

  • num_blocks (int) – Number of blocks to fit on SM.

  • block_size (int) – Size of the blocks.

Returns:

Returned maximum dynamic shared memory.

Return type:

size_t

See also

cuOccupancyAvailableDynamicSMemPerBlock