GmAlloc

Function Usage

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

void *GmAlloc(size_t size)

Parameters

Parameter

Input/Output

Description

size

Input

Size of the shared memory to be allocated.

Returns

void* mem;

This pointer indicates the initial address of the shared memory space.

Availability

Atlas Training Series Product

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.

Example

constexpr int32_t len = 8 * 32 * 1024 * 8;
half* x = (half*) GmAlloc(len*sizeof(half));