Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::BArena Class Reference

Basic Arena that allocates aligned memory on the host heap. More...

#include <AMReX_BArena.H>

Inheritance diagram for amrex::BArena:
amrex::Arena

Public Member Functions

void * alloc (std::size_t sz) final
 Allocate host memory.
 
void free (void *pt) final
 Free memory previously returned by alloc().
 
bool isDeviceAccessible () const final
 Return false; BArena allocations are not device accessible.
 
bool isHostAccessible () const final
 Return true; BArena allocations reside on the host.
 
bool isManaged () const final
 Return false; BArena memory is not managed/unified.
 
bool isDevice () const final
 Return false; BArena operates on the host.
 
bool isPinned () const final
 Return false; BArena does not allocate pinned memory.
 
- Public Member Functions inherited from amrex::Arena
virtual ~Arena ()=default
 
 Arena () noexcept=default
 
 Arena (const Arena &rhs)=delete
 
 Arena (Arena &&rhs)=delete
 
Arenaoperator= (const Arena &rhs)=delete
 
Arenaoperator= (Arena &&rhs)=delete
 
virtual std::pair< void *, std::size_t > alloc_in_place (void *pt, std::size_t szmin, std::size_t szmax)
 Allocate memory in-place if possible.
 
virtual void * shrink_in_place (void *pt, std::size_t sz)
 Shrink allocation size in-place.
 
virtual std::size_t freeUnused ()
 Release unused cached memory back to the system.
 
virtual std::size_t largestFreeBlock () const
 Return the largest free memory block already held by this Arena.
 
virtual bool hasFreeDeviceMemory (std::size_t sz)
 Does the device have enough free memory for allocating this much memory? For CPU builds, this always return true. This is not a const function because it may attempt to release memory back to the system.
 
void registerForProfiling (const std::string &memory_name)
 Add this Arena to the list of Arenas that are profiled by TinyProfiler.
 
void deregisterFromProfiling ()
 Remove this Arena from the list of Arenas that are profiled by TinyProfiler. This is equivalent to destructing and re-constructing the Arena.
 
virtual bool isStreamOrderedArena () const
 Is this GPU stream ordered memory allocator?
 
virtual void streamOrderedFree (void *pt, gpuStream_t stream)
 
const ArenaInfoarenaInfo () const
 Return the ArenaInfo object for querying.
 
virtual void ResetMaxUsageCounter ()
 

Additional Inherited Members

- Static Public Member Functions inherited from amrex::Arena
static std::size_t align (std::size_t sz)
 Return the smallest multiple of Arena::align_size that is >= sz bytes.
 
static void Initialize (bool minimal)
 Initialize the Arena subsystem (used internally by AMReX).
 
static void PrintUsage (bool print_max_usage=false)
 Print memory usage information of all arenas.
 
static void PrintUsageToStream (std::ostream &os, std::string const &space)
 Print memory usage information of all arenas to a given output stream.
 
static void PrintUsageToFiles (std::string const &filename, std::string const &message)
 Print memory usage information of all arenas to given file.
 
static void Finalize ()
 Used internally by amrex.
 
static bool IsInitialized ()
 
- Static Public Attributes inherited from amrex::Arena
static const std::size_t align_size = 256
 
- Protected Member Functions inherited from amrex::Arena
virtual std::size_t freeUnused_protected ()
 
void * allocate_system (std::size_t nbytes)
 
void deallocate_system (void *p, std::size_t nbytes)
 
- Static Protected Member Functions inherited from amrex::Arena
static void out_of_memory_abort (std::string const &memory_type, std::size_t nbytes, std::string const &error_msg)
 
- Protected Attributes inherited from amrex::Arena
ArenaInfo arena_info
 

Detailed Description

Basic Arena that allocates aligned memory on the host heap.

Member Function Documentation

◆ alloc()

void * amrex::BArena::alloc ( std::size_t  sz)
finalvirtual

Allocate host memory.

Parameters
szNumber of bytes to allocate.
Returns
Aligned host pointer to the allocated memory.

Implements amrex::Arena.

◆ free()

void amrex::BArena::free ( void *  pt)
finalvirtual

Free memory previously returned by alloc().

Parameters
ptPointer to the allocation to release.

Implements amrex::Arena.

◆ isDevice()

bool amrex::BArena::isDevice ( ) const
finalvirtual

Return false; BArena operates on the host.

Reimplemented from amrex::Arena.

◆ isDeviceAccessible()

bool amrex::BArena::isDeviceAccessible ( ) const
finalvirtual

Return false; BArena allocations are not device accessible.

Reimplemented from amrex::Arena.

◆ isHostAccessible()

bool amrex::BArena::isHostAccessible ( ) const
finalvirtual

Return true; BArena allocations reside on the host.

Reimplemented from amrex::Arena.

◆ isManaged()

bool amrex::BArena::isManaged ( ) const
finalvirtual

Return false; BArena memory is not managed/unified.

Reimplemented from amrex::Arena.

◆ isPinned()

bool amrex::BArena::isPinned ( ) const
finalvirtual

Return false; BArena does not allocate pinned memory.

Reimplemented from amrex::Arena.


The documentation for this class was generated from the following files: