On devices where the L1 cache and shared memory use the same hardware resources, this sets through cacheConfig
the preferred cache configuration for the function specified via func
. This is only a preference. The runtime will use the requested configuration if possible, but it is free to choose a different configuration if required to execute func
.
func
is a device function symbol and must be declared as a __global__
function. If the specified function does not exist, then cudaErrorInvalidDeviceFunction is returned.
This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.
Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.
The supported cache configurations are:
- Parameters:
-
| func | - Char string naming device function |
| cacheConfig | - Requested cache configuration |
- Returns:
- cudaSuccess, cudaErrorInitializationError, cudaErrorInvalidDeviceFunction
- Note:
- The
func
paramater may also be a character string that specifies the fully-decorated (C++) name for a function that executes on the device, however this usage is deprecated as of CUDA 4.1.
Note that this function may also return error codes from previous, asynchronous launches.
- See also:
- cudaConfigureCall, cudaFuncSetCacheConfig (C++ API), cudaFuncGetAttributes (C API), cudaLaunch (C API), cudaSetDoubleForDevice, cudaSetDoubleForHost, cudaSetupArgument (C API), cudaThreadGetCacheConfig, cudaThreadSetCacheConfig