aclrtMemsetAsync

Description

Initializes memory to a specified value. This API is asynchronous.

The system determines whether the memory to be initialized is on the host or device based on the address.

Restrictions

This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, you need to call a synchronization API (for example, aclrtSynchronizeStream) to ensure that the memory initialization task is complete. Otherwise, service exceptions (such as training or inference exception) or unknown situations (such as device link or card disconnection) may occur.

Prototype

aclError aclrtMemsetAsync(void *devPtr, size_t maxCount, int32_t value, size_t count, aclrtStream stream)

Parameters

Parameter

Input/Output

Description

devPtr

Input

Pointer to the memory start address.

maxCount

Input

Memory size in bytes.

value

Input

Value to set.

count

Input

Memory size to set, in bytes.

stream

Input

Stream.

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.