aclrtMemGetAddressRange

Applicable Products

Product

Supported

Ascend 950PR/Ascend 950DT

√

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

√

Function

Obtains the start address and size of the memory block to which the address to be queried belongs.

Prototype

1
aclError aclrtMemGetAddressRange(void *ptr, void **pbase, size_t *psize)

Parameters

Parameter

Input/Output

Description

ptr

Input

Memory address to be queried.

pbase

Output

Start address of the memory block to which the address to be queried belongs.

psize

Output

Size of the memory block to which the address to be queried belongs, in bytes.

Returns

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

References

Scenario

aclrtMemGetAddressRange API Output

Querying the device memory returned by the aclrtMalloc or aclrtMallocWithCfg API

Start address and size of the memory block

Querying the host memory returned by the aclrtMallocHost or aclrtMallocHostWithCfg API

Start address and size of the memory block

Querying the virtual memory address mapped by the aclrtReserveMemAddress, aclrtMallocPhysical, or aclrtMapMem API

Start address and size of the mapped memory block