aclrtHostRegisterV2
Applicability
Supported |
|
|---|---|
Atlas A3 Training Series Product |
√ |
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product |
√ |
Atlas 200/500 A2 Inference Product |
☓ |
Atlas Inference Series Product |
☓ |
Atlas Training Series Product |
√ |
Description
Registers the host memory address.
To unregister the memory, call the aclrtHostUnregister API.
Prototype
aclError aclrtHostRegisterV2(void *ptr, uint64_t size, uint32_t flag)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
ptr |
Input |
Host memory address. The host memory address must be 4K-page-aligned. If the OS kernel version is 5.10 or earlier, using non-page-locked memory will cause exceptions. Therefore, you must call aclrtMallocHost or aclrtMallocHostWithCfg to allocate page-locked host memory. If the OS kernel version is later than 5.10, non-page-locked host memory can be used. Therefore, you can either call aclrtMallocHost or aclrtMallocHostWithCfg to allocate page-locked host memory, or call malloc to allocate non-page-locked host memory. |
size |
Input |
Memory size, in bytes. |
flag |
Input |
Memory registration type. The value can be either of the following macros:
The macros are defined as follows: #define ACL_HOST_REG_MAPPED 0x2UL #define ACL_HOST_REG_PINNED 0X10000000UL |
Returns
0 on success; else, failure. For details, see aclError.