aclrtMallocHostWithCfg

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Allocates the host memory (lock page 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 information when allocating memory.

For the Ascend RC form, the host and device are integrated. Therefore, allocating the host memory is equivalent to allocating the device memory. In addition, memory is allocated based on normal pages. If the start address needs to be 64-byte aligned, you need to handle the alignment problem by yourself.

Prototype

aclError aclrtMallocHostWithCfg(void **ptr, uint64_t size, aclrtMallocConfig *cfg)

Parameters

Parameter

Input/Output

Description

ptr

Output

Pointer to allocated memory.

size

Input

Requested allocation size in bytes.

The size cannot be 0.

cfg

Input

Memory configuration.

If no configuration is specified, NULL can be passed.

Returns

0 on success; else, failure. For details, see aclError.