GADGET-4
|
#include <mymalloc.h>
Inherits setcomm.
Public Member Functions | |
memory () | |
void | mymalloc_init (int maxmemsize, enum restart_options restartflag) |
Initialize memory manager. More... | |
void * | mymalloc_movable_fullinfo (void *ptr, const char *varname, size_t n, const char *func, const char *file, int line, int movable_flag, int clear_flag, char *originflag) |
Allocate a movable memory block and store the relative information. More... | |
void * | myrealloc_movable_fullinfo (void *p, size_t n, const char *func, const char *file, int line, int movable_flag) |
Reallocate an existing movable memory block. More... | |
void | myfree_movable_fullinfo (void *p, const char *func, const char *file, int line, int movable_flag) |
Deallocate a movable memory block. More... | |
void * | myfree_query_last_block (void) |
size_t | roundup_to_multiple_of_cacheline_size (size_t n) |
void | report_detailed_memory_usage_of_largest_task (void) |
Output memory usage for the task with the greatest amount of memory allocated. More... | |
void | check_maxmemsize_setting (int maxmemsize) |
int | myMPI_Win_allocate_shared (MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, void *baseptr, MPI_Win *win) |
int | myMPI_Win_shared_query (MPI_Win win, int rank, MPI_Aint *size, int *disp_unit, void *baseptr) |
double | getAllocatedBytesInMB (void) |
template<typename T > | |
T * | alloc (T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr) |
template<typename T > | |
T * | alloc_movable (T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr) |
template<typename T > | |
T * | realloc (T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr) |
template<typename T > | |
T * | realloc_movable (T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr) |
void | dealloc (void *ptr, const char *func, const char *file, int linenr) |
void | dealloc_movable (void *ptr, const char *func, const char *file, int linenr) |
void | dump_memory_table (void) |
Dump the buffer where the memory information is stored to the standard output. More... | |
Public Member Functions inherited from setcomm | |
setcomm (MPI_Comm Comm) | |
setcomm (const char *str) | |
void | initcomm (MPI_Comm Comm) |
void | mpi_printf (const char *fmt,...) |
void | determine_compute_nodes (void) |
Public Attributes | |
size_t | AllocatedBytes |
size_t | FreeBytes |
char * | Base |
Public Attributes inherited from setcomm | |
MPI_Comm | Communicator |
int | NTask |
int | ThisTask |
int | PTask |
int | ThisNode |
int | NumNodes = 0 |
int | TasksInThisNode |
int | RankInThisNode |
int | MinTasksPerNode |
int | MaxTasksPerNode |
long long | MemoryOnNode |
long long | SharedMemoryOnNode |
Definition at line 42 of file mymalloc.h.
|
inline |
Definition at line 45 of file mymalloc.h.
|
inline |
Definition at line 74 of file mymalloc.h.
|
inline |
Definition at line 80 of file mymalloc.h.
void check_maxmemsize_setting | ( | int | maxmemsize | ) |
Definition at line 684 of file mymalloc.cc.
|
inline |
Definition at line 97 of file mymalloc.h.
|
inline |
Definition at line 99 of file mymalloc.h.
void dump_memory_table | ( | void | ) |
Dump the buffer where the memory information is stored to the standard output.
Definition at line 355 of file mymalloc.cc.
|
inline |
Definition at line 71 of file mymalloc.h.
void myfree_movable_fullinfo | ( | void * | p, |
const char * | func, | ||
const char * | file, | ||
int | line, | ||
int | movable_flag | ||
) |
Deallocate a movable memory block.
For this operation to be successful all the blocks allocated after the block that has to be freed must be of movable type.
p | pointer to the memory block to be deallocated |
func | name of function that has called the deallocation routine (usually given by the FUNCTION macro) |
file | file where the function that has called the deallocation routine resides (usually given by the FILE macro) |
line | line number of file where the deallocation routine was called (usually given by the LINE macro) |
Definition at line 490 of file mymalloc.cc.
void * myfree_query_last_block | ( | void | ) |
Definition at line 473 of file mymalloc.cc.
void mymalloc_init | ( | int | maxmemsize, |
enum restart_options | restartflag | ||
) |
Initialize memory manager.
This function initializes the memory manager. In particular, it sets the global variables of the module to their initial value and allocates the memory for the stack.
Definition at line 58 of file mymalloc.cc.
void * mymalloc_movable_fullinfo | ( | void * | ptr, |
const char * | varname, | ||
size_t | n, | ||
const char * | func, | ||
const char * | file, | ||
int | line, | ||
int | movable_flag, | ||
int | clear_flag, | ||
char * | callorigin | ||
) |
Allocate a movable memory block and store the relative information.
ptr | pointer to the initial memory address of the block |
varname | name of the variable to be stored in the allocated block |
n | size of the memory block in bytes |
func | name of function that has called the allocation routine (usually given by the FUNCTION macro) |
file | file where the function that has called the allocation routine resides (usually given by the FILE macro) |
line | line number of file where the allocation routine was called (usually given by the LINE macro) |
Definition at line 402 of file mymalloc.cc.
int myMPI_Win_allocate_shared | ( | MPI_Aint | size, |
int | disp_unit, | ||
MPI_Info | info, | ||
MPI_Comm | comm, | ||
void * | baseptr, | ||
MPI_Win * | win | ||
) |
Definition at line 177 of file mymalloc.cc.
int myMPI_Win_shared_query | ( | MPI_Win | win, |
int | rank, | ||
MPI_Aint * | size, | ||
int * | disp_unit, | ||
void * | baseptr | ||
) |
Definition at line 250 of file mymalloc.cc.
void * myrealloc_movable_fullinfo | ( | void * | p, |
size_t | n, | ||
const char * | func, | ||
const char * | file, | ||
int | line, | ||
int | movable_flag | ||
) |
Reallocate an existing movable memory block.
For this operation to be successful all the blocks allocated after the block that has to be reallocated must be of movable type.
p | pointer to the existing memory block to be reallocated |
n | the new size of the memory block in bytes |
func | name of function that has called the reallocation routine (usually given by the FUNCTION macro) |
file | file where the function that has called the reallocation routine resides (usually given by the FILE macro) |
line | line number of file where the reallocation routine was called (usually given by the LINE macro) |
Definition at line 591 of file mymalloc.cc.
|
inline |
Definition at line 86 of file mymalloc.h.
|
inline |
Definition at line 92 of file mymalloc.h.
void report_detailed_memory_usage_of_largest_task | ( | void | ) |
Output memory usage for the task with the greatest amount of memory allocated.
Definition at line 311 of file mymalloc.cc.
size_t roundup_to_multiple_of_cacheline_size | ( | size_t | n | ) |
Definition at line 465 of file mymalloc.cc.
size_t AllocatedBytes |
Definition at line 47 of file mymalloc.h.
char* Base |
Base pointer (initial memory address) of the stack.
Definition at line 49 of file mymalloc.h.
size_t FreeBytes |
Definition at line 48 of file mymalloc.h.