Skip to main content

cudaDeviceSetSharedMemConfig

Function cudaDeviceSetSharedMemConfig 

Source
pub unsafe extern "C" fn cudaDeviceSetSharedMemConfig(
    config: cudaSharedMemConfig,
) -> cudaError_t
👎Deprecated
Expand description

Sets the shared memory configuration for the current device.

On devices with configurable shared memory banks, this function will set the shared memory bank size which is used for all subsequent kernel launches. Any per-function setting of shared memory set via cudaFuncSetSharedMemConfig will override the device wide setting.

Changing the shared memory configuration between launches may introduce a device side synchronization point.

Changing the shared memory bank size will not increase shared memory usage or affect occupancy of kernels, but may have major effects on performance. Larger bank sizes will allow for greater potential bandwidth to shared memory, but will change what kinds of accesses to shared memory will result in bank conflicts.

This function will do nothing on devices with fixed shared memory bank size.

The supported bank configurations are:

  • cudaSharedMemBankSizeDefault: set bank width the device default (currently, four bytes)
  • cudaSharedMemBankSizeFourByte: set shared memory bank width to be four bytes natively.
  • cudaSharedMemBankSizeEightByte: set shared memory bank width to be eight bytes natively.

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.

§Parameters

  • config: Requested cache configuration

§Return value

See also: cudaDeviceSetCacheConfig, cudaDeviceGetCacheConfig, cudaDeviceGetSharedMemConfig, cudaFuncSetCacheConfig, cuCtxSetSharedMemConfig.