Skip to main content

cudaMemsetAsync

Function cudaMemsetAsync 

Source
pub unsafe extern "C" fn cudaMemsetAsync(
    devPtr: *mut c_void,
    value: c_int,
    count: size_t,
    stream: cudaStream_t,
) -> cudaError_t
Expand description

Initializes or sets device memory to a value.

Fills the first count bytes of the memory area pointed to by devPtr with the constant byte value value.

cudaMemsetAsync is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero stream argument. If stream is non-zero, the operation may overlap with operations in other streams.

The device version of this function only handles device to device copies and cannot be given local or shared pointers.

Note that this function may also return error codes from previous, asynchronous launches.

Note: See also memset synchronization details.

Note: This function uses standard default stream semantics.

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

  • devPtr: Pointer to device memory.
  • value: Value to set for each byte of specified memory.
  • count: Size in bytes to set.
  • stream: Stream identifier.

§Return value

See also: cudaMemset, cudaMemset2D, cudaMemset3D, cudaMemset2DAsync, cudaMemset3DAsync, cuMemsetD8Async, cuMemsetD16Async, cuMemsetD32Async.