#include <gromacs/utility/include/gromacs/utility/alignedallocator.h>
Policy class for configuring gmx::Allocator, to manage allocations of page-aligned memory that can be locked for asynchronous transfer to GPU devices.
std::size_t gmx::PageAlignedAllocationPolicy::alignment |
( |
| ) |
|
|
static |
Return the alignment size of memory pages on this system.
Queries sysconf/WinAPI, otherwise guesses 4096.
void gmx::PageAlignedAllocationPolicy::free |
( |
void * |
p | ) |
|
|
static |
void * gmx::PageAlignedAllocationPolicy::malloc |
( |
std::size_t |
bytes | ) |
|
|
static |
Allocate memory aligned to alignment() bytes.
- Parameters
-
bytes | Amount of memory (bytes) to allocate. It is valid to ask for 0 bytes, which will return a non-null pointer that is properly aligned and padded (but that you should not use). |
- Returns
- Valid pointer if the allocation worked, otherwise nullptr.
- Note
- Memory allocated with this routine must be released with gmx::PageAlignedAllocationPolicy::free(), and absolutely not the system free().
The documentation for this class was generated from the following files:
- src/gromacs/utility/include/gromacs/utility/alignedallocator.h
- src/gromacs/utility/alignedallocator.cpp