pub unsafe extern "C" fn cudaFuncSetAttribute(
func: *const c_void,
attr: cudaFuncAttribute,
value: c_int,
) -> cudaError_t
Expand description
\brief Set attributes for a given function
This function sets the attributes of a function specified via \p func. The parameter \p func must be a pointer to a function that executes on the device. The parameter specified by \p func must be declared as a \p global function. The enumeration defined by \p attr is set to the value defined by \p value. If the specified function does not exist, then ::cudaErrorInvalidDeviceFunction is returned. If the specified attribute cannot be written, or if the value is incorrect, then ::cudaErrorInvalidValue is returned.
Valid values for \p attr are:
- ::cudaFuncAttributeMaxDynamicSharedMemorySize - The requested maximum size in bytes of dynamically-allocated shared memory. The sum of this value and the function attribute ::sharedSizeBytes cannot exceed the device attribute ::cudaDevAttrMaxSharedMemoryPerBlockOptin. The maximal size of requestable dynamic shared memory may differ by GPU architecture.
- ::cudaFuncAttributePreferredSharedMemoryCarveout - On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference, in percent of the total shared memory. See ::cudaDevAttrMaxSharedMemoryPerMultiprocessor. This is only a hint, and the driver can choose a different ratio if required to execute the function.
- ::cudaFuncAttributeRequiredClusterWidth: The required cluster width in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted.
- ::cudaFuncAttributeRequiredClusterHeight: The required cluster height in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted.
- ::cudaFuncAttributeRequiredClusterDepth: The required cluster depth in blocks. The width, height, and depth values must either all be 0 or all be positive. The validity of the cluster dimensions is checked at launch time. If the value is set during compile time, it cannot be set at runtime. Setting it at runtime will return cudaErrorNotPermitted.
- ::cudaFuncAttributeNonPortableClusterSizeAllowed: Indicates whether the function can be launched with non-portable cluster size. 1 is allowed, 0 is disallowed.
- ::cudaFuncAttributeClusterSchedulingPolicyPreference: The block scheduling policy of a function. The value type is cudaClusterSchedulingPolicy.
\param func - Function to get attributes of \param attr - Attribute to set \param value - Value to set
\return ::cudaSuccess, ::cudaErrorInvalidDeviceFunction, ::cudaErrorInvalidValue \notefnerr \note_init_rt \note_callback
\ref ::cudaLaunchKernel(const T func, dim3 gridDim, dim3 blockDim, void args, size_t sharedMem, cudaStream_t stream) “cudaLaunchKernel (C++ API)”, \ref ::cudaFuncSetCacheConfig(T, enum cudaFuncCache) “cudaFuncSetCacheConfig (C++ API)”, \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes, const void) “cudaFuncGetAttributes (C API)”,