aclrtReserveMemAddress
Applicable Products
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function
Reserves virtual memory.
- Call aclrtReserveMemAddress to allocate virtual memory.
- Call aclrtMallocPhysical to allocate physical memory.
- Call aclrtMapMem to map virtual memory to physical memory.
- Call specific task APIs to execute tasks.
- Call aclrtUnmapMem to cancel the mapping between virtual memory and physical memory.
- Call aclrtFreePhysical to free physical memory.
- Call aclrtReleaseMemAddress to free virtual memory.
Prototype
1
|
aclError aclrtReserveMemAddress(void **virPtr, size_t size, size_t alignment, void *expectPtr, uint64_t flags) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
virPtr |
Output |
Pointer to the pointer to the allocated virtual memory address. |
|
size |
Input |
Virtual memory size, in bytes. size cannot be 0. |
|
alignment |
Input |
Alignment value of the virtual address. This parameter is reserved and can only be set to 0. |
|
expectPtr |
Input |
Start address of the virtual memory to be returned.
The value can be:
|
|
flags |
Input |
Reserved. The value 0 is recommended. |
Returns
0 on success; otherwise, failure. For details, see aclError.
Restrictions
Atlas 200I/500 A2 inference products in Ascend RC form: This API is not supported.
- To use the virtual memory reserved by this API, only aclrtMemcpyAsync can be called to copy data between two devices in the single-process scenario.