Product |
Supported (√/x) |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Initializes the memory and sets the content in the 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. If the host memory is not allocated by calling an acl API (for example, acl.rt.malloc_host), undefined behavior will occur.
1 | aclError aclrtMemsetAsync(void *devPtr, size_t maxCount, int32_t value, size_t count, aclrtStream stream) |
1 | ret = acl.rt.memset_async(dev_ptr, max_count, value, count, stream) |
Parameter |
Description |
|---|---|
dev_ptr |
Int, start address of the memory. |
max_count |
Int, maximum memory size, in bytes. |
value |
Int, value to be set. |
count |
Int, memory length to be set to a specified value, in bytes. |
stream |
Int, pointer address of the stream. |
Return Value |
Description |
|---|---|
ret |
Int, error code. 0 on success; else, failure. |
This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, you must call a synchronization API (for example, acl.rt.synchronize_stream) 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.