Skip to main content

cuKernelSetAttribute

Function cuKernelSetAttribute 

Source
pub unsafe extern "C" fn cuKernelSetAttribute(
    attrib: CUfunction_attribute,
    val: c_int,
    kernel: CUkernel,
    dev: CUdevice,
) -> CUresult
Expand description

Sets information about a kernel.

This call sets the value of a specified attribute attrib on the kernel kernel for the requested device dev to an integer value specified by val. This function returns CUresult::CUDA_SUCCESS if the new value of the attribute could be successfully set. If the set fails, this call will return an error. Not all attributes can have values set. Attempting to set a value on a read-only attribute will result in an error (CUresult::CUDA_ERROR_INVALID_VALUE)

Note that attributes set using cuFuncSetAttribute will override the attribute set by this API irrespective of whether the call to cuFuncSetAttribute is made before or after this API call. However, cuKernelGetAttribute will always return the attribute value set by this API.

Supported attributes are:

Note: The API has stricter locking requirements in comparison to its legacy counterpart cuFuncSetAttribute due to device-wide semantics. If multiple threads are trying to set the same attribute on the same device simultaneously, the attribute setting will depend on the interleavings chosen by the OS scheduler and memory consistency.

§Parameters

  • attrib: Attribute requested.
  • val: Value to set.
  • kernel: Kernel to set attribute of.
  • dev: Device to set attribute of.

§Return value

See also: cuLibraryLoadData, cuLibraryLoadFromFile, cuLibraryUnload, cuKernelGetAttribute, cuLibraryGetKernel, cuLaunchKernel, cuKernelGetFunction, cuLibraryGetModule, cuModuleGetFunction, cuFuncSetAttribute.