aclrtMallocHostWithCfg
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function
Allocates host memory (page-locked memory). The system ensures that the start address of the memory is 64-byte aligned.
Compared with aclrtMallocHost, this API can also specify memory configuration when allocating memory.
The memory allocated by this API can only be freed by calling aclrtFreeHost or aclrtFreeHostWithDevSync.
For the
Prototype
1 | aclError aclrtMallocHostWithCfg(void **ptr, uint64_t size, aclrtMallocConfig *cfg) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
ptr |
Output |
Pointer to the pointer to the allocated memory. |
size |
Input |
Memory size in bytes to allocate. size cannot be 0. |
cfg |
Input |
Memory configuration. For details about the type definition, see aclrtMallocConfig. If no configuration is specified, NULL can be passed. |
Returns
0 on success; otherwise, failure. For details, see aclError.