Function: malloc
|
C Prototype |
aclError aclrtMalloc(void **devPtr, size_t size, aclrtMemMallocPolicy policy) |
|---|---|
|
Python Function |
dev_ptr, ret = acl.rt.malloc(size, policy) |
|
Function Usage |
Allocates size bytes of linear memory on the device and returns in dev_ptr a pointer to the allocated memory. The allocation size is the input size rounded up to the nearest multiple of 32 bytes, plus 32 bytes. |
|
Input Description |
size: int, size of the allocated memory in bytes. The value cannot be 0. policy: int, memory allocation rule. For details, see aclrtMemMallocPolicy. |
|
Return Value |
dev_ptr: int, address of the pointer to the allocated device memory. ret: int, error code.
|
|
Restrictions |
|
|
Reference |