aclrtBinaryGetGlobal

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 device-side memory address and size of a global variable in the operator binary based on the variable name.

Prototype

1
aclError aclrtBinaryGetGlobal(aclrtBinHandle binHandle, const char *name, void **dptr, size_t *size)

Parameters

Parameter

Input/Output

Description

binHandle

Input

Operator binary handle. For details about the type definition, see aclrtBinHandle.

Call aclrtBinaryLoadFromFile or aclrtBinaryLoadFromData to obtain the operator binary handle and pass it as an input parameter.

name

Input

Global variable name, which must be the same as that defined in the operator binary.

dptr

Output

Pointer to the address of a global variable on the device.

If nullptr is passed, the address does not need to be obtained.

size

Output

Size of a global variable on the device, in bytes.

If nullptr is passed, the size does not need to be obtained.

dptr and size cannot be both nullptr.

Returns

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