Skip to main content

cudaOccupancyAvailableDynamicSMemPerBlock

Function cudaOccupancyAvailableDynamicSMemPerBlock 

Source
pub unsafe extern "C" fn cudaOccupancyAvailableDynamicSMemPerBlock(
    dynamicSmemSize: *mut size_t,
    func: *const c_void,
    numBlocks: c_int,
    blockSize: c_int,
) -> cudaError_t
Expand description

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

Returns in *dynamicSmemSize the maximum size of dynamic shared memory to allow numBlocks blocks per SM.

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

  • dynamicSmemSize: Returned maximum dynamic shared memory.
  • func: Kernel function for which occupancy is calculated.
  • numBlocks: Number of blocks to fit on SM.
  • blockSize: Size of the block.

§Return value

See also: cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, cudaOccupancyMaxPotentialBlockSize (C++ API), cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API), cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API).