Function rcudnn_sys::cudaFuncSetAttribute[][src]

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.

\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)”,