GmAlloc

Supported Products

Product

Supported/Unsupported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference product's AI Core

Atlas inference product's Vector Core

x

Atlas training products

Functions

Creates shared memory during verification of the CPU-side operation of the kernel function. That is, creates a shared file in the /tmp directory and returns the mapping pointer to the file.

Prototype

1
void *GmAlloc(size_t size)

Parameters

Parameter

Input/Output

Description

size

Input

Size of the shared memory to be allocated.

Returns

Returns the start address of the shared memory space.

Constraints

This API generates a temporary file in the system /tmp directory. Therefore, the shared memory can be properly generated only when the drive space is sufficient.

Examples

1
2
constexpr size_t len = 8 * 32 * 1024 * 8;
half* x = (half*) GmAlloc(len*sizeof(half));