Memory menagement functions for CPU and GPU.
More...
#include <vector>
#include <unordered_map>
Go to the source code of this file.
|
#define | PARGEMSLR_MALLOC_VOID(ptr, length, location) |
|
#define | PARGEMSLR_MALLOC(ptr, length, location, ...) |
|
#define | PARGEMSLR_CALLOC_VOID(ptr, length, location) |
|
#define | PARGEMSLR_CALLOC(ptr, length, location, ...) |
|
#define | PARGEMSLR_REALLOC_VOID(ptr, current_length, new_length, location) |
|
#define | PARGEMSLR_REALLOC(ptr, current_length, new_length, location, ...) |
|
#define | PARGEMSLR_MEMCPY(ptr_to, ptr_from, length, loc_to, loc_from, ...) |
|
#define | PARGEMSLR_FREE(ptr, location) |
|
#define | PARGEMSLR_PLACEMENT_NEW(ptr, location, ...) |
|
|
void * | pargemslr::PargemslrMalloc (size_t length, int location) |
| Malloc memory at given location. More...
|
|
void * | pargemslr::PargemslrCalloc (size_t length, int location) |
| Calloc memory at given location. More...
|
|
void * | pargemslr::PargemslrRealloc (void *ptr, size_t current_length, size_t new_length, int location) |
| Realloc memory at given location. More...
|
|
void | pargemslr::PargemslrMemcpy (void *ptr_to, const void *ptr_from, size_t length, int loc_to, int loc_from) |
| Memory copy function. More...
|
|
void | pargemslr::PargemslrFree (void *ptr, int location) |
| Free the memory. More...
|
|
◆ PARGEMSLR_CALLOC
#define PARGEMSLR_CALLOC |
( |
|
ptr, |
|
|
|
length, |
|
|
|
location, |
|
|
|
... |
|
) |
| |
Value: {\
(ptr) = (__VA_ARGS__*) pargemslr::PargemslrCalloc( (size_t)(length)*sizeof(__VA_ARGS__), location);\
}
◆ PARGEMSLR_CALLOC_VOID
#define PARGEMSLR_CALLOC_VOID |
( |
|
ptr, |
|
|
|
length, |
|
|
|
location |
|
) |
| |
Value: {\
(ptr) = pargemslr::PargemslrCalloc( (size_t)(length), location);\
}
◆ PARGEMSLR_FREE
#define PARGEMSLR_FREE |
( |
|
ptr, |
|
|
|
location |
|
) |
| |
Value: {\
pargemslr::PargemslrFree( (void*)(ptr), location);\
(ptr) = NULL;\
}
◆ PARGEMSLR_MALLOC
#define PARGEMSLR_MALLOC |
( |
|
ptr, |
|
|
|
length, |
|
|
|
location, |
|
|
|
... |
|
) |
| |
Value: {\
(ptr) = (__VA_ARGS__*) pargemslr::PargemslrMalloc( (size_t)(length)*sizeof(__VA_ARGS__), location);\
}
◆ PARGEMSLR_MALLOC_VOID
#define PARGEMSLR_MALLOC_VOID |
( |
|
ptr, |
|
|
|
length, |
|
|
|
location |
|
) |
| |
Value: {\
(ptr) = pargemslr::PargemslrMalloc( (size_t)(length), location);\
}
◆ PARGEMSLR_MEMCPY
#define PARGEMSLR_MEMCPY |
( |
|
ptr_to, |
|
|
|
ptr_from, |
|
|
|
length, |
|
|
|
loc_to, |
|
|
|
loc_from, |
|
|
|
... |
|
) |
| |
Value: {\
pargemslr::PargemslrMemcpy( (void*)(ptr_to), (void*)(ptr_from), (size_t)(length)*sizeof(__VA_ARGS__), loc_to, loc_from);\
}
◆ PARGEMSLR_PLACEMENT_NEW
#define PARGEMSLR_PLACEMENT_NEW |
( |
|
ptr, |
|
|
|
location, |
|
|
|
... |
|
) |
| |
Value: {\
(ptr) = (__VA_ARGS__*) pargemslr::PargemslrMalloc( (size_t)sizeof(__VA_ARGS__), location);\
(ptr) = new (ptr) __VA_ARGS__();\
}
◆ PARGEMSLR_REALLOC
#define PARGEMSLR_REALLOC |
( |
|
ptr, |
|
|
|
current_length, |
|
|
|
new_length, |
|
|
|
location, |
|
|
|
... |
|
) |
| |
Value: {\
(ptr) = (__VA_ARGS__*) pargemslr::PargemslrRealloc( (void*)(ptr), (size_t)(current_length)*sizeof(__VA_ARGS__), (size_t)(new_length)*sizeof(__VA_ARGS__), location);\
}
◆ PARGEMSLR_REALLOC_VOID
#define PARGEMSLR_REALLOC_VOID |
( |
|
ptr, |
|
|
|
current_length, |
|
|
|
new_length, |
|
|
|
location |
|
) |
| |
Value: {\
(ptr) = (void*) pargemslr::PargemslrRealloc( (void*)(ptr), (size_t)(current_length), (size_t)(new_length), location);\
}
◆ MemoryLocationEnum
The memory location. Host, device, shared, page-locked.
◆ PargemslrCalloc()
void * pargemslr::PargemslrCalloc |
( |
size_t |
length, |
|
|
int |
location |
|
) |
| |
Calloc memory at given location.
- Parameters
-
[in] | length | The length of array. |
[in] | location | The location of the array. |
- Returns
- Return pointer to the memory location.
◆ PargemslrFree()
void pargemslr::PargemslrFree |
( |
void * |
ptr, |
|
|
int |
location |
|
) |
| |
Free the memory.
- Parameters
-
[in,out] | ptr | Pointer to the memory, set to NULL on return. |
[in] | location | Location of the memory. |
◆ PargemslrMalloc()
void * pargemslr::PargemslrMalloc |
( |
size_t |
length, |
|
|
int |
location |
|
) |
| |
Malloc memory at given location.
- Parameters
-
[in] | length | The length of the array. |
[in] | location | The location of the array. |
- Returns
- Return pointer to the memory location.
◆ PargemslrMemcpy()
void pargemslr::PargemslrMemcpy |
( |
void * |
ptr_to, |
|
|
const void * |
ptr_from, |
|
|
size_t |
length, |
|
|
int |
loc_to, |
|
|
int |
loc_from |
|
) |
| |
Memory copy function.
- Parameters
-
[in] | ptr_to | Copy to this address. |
[in] | ptr_from | Copy from this address. |
[in] | length | The length of the array. |
[in] | loc_to | Location of ptr_to. |
[in] | loc_from | Location of ptr_from. |
◆ PargemslrRealloc()
void * pargemslr::PargemslrRealloc |
( |
void * |
ptr, |
|
|
size_t |
current_length, |
|
|
size_t |
new_length, |
|
|
int |
location |
|
) |
| |
Realloc memory at given location.
- Parameters
-
[in] | ptr | The pointer to the memory location. |
[in] | current_length | Current length of the array. |
[in] | new_length | Wanted length of the array. |
[in] | location | The location of the array. |
- Returns
- Return pointer to the memory location.