Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_SArena.H
Go to the documentation of this file.
1#ifndef AMREX_SARENA_H_
2#define AMREX_SARENA_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_Arena.H>
6#ifdef AMREX_USE_GPU
7#include <AMReX_GpuControl.H>
8#endif
9
10
11namespace amrex {
28class SArena
29 :
30 public Arena
31{
32public:
39 [[nodiscard]] void* alloc (std::size_t sz) final;
46 void free (void* pt) final;
47
48 [[nodiscard]] bool isDeviceAccessible () const final;
49 [[nodiscard]] bool isHostAccessible () const final;
50
51 [[nodiscard]] bool isManaged () const final;
52 [[nodiscard]] bool isDevice () const final;
53 [[nodiscard]] bool isPinned () const final;
54
55#ifdef AMREX_USE_GPU
57 [[nodiscard]] bool isStreamOrderedArena () const final { return true; }
58 void streamOrderedFree (void* pt, gpuStream_t stream) override;
59#endif
60};
61
62}
63
64#endif
A virtual base class for objects that manage their own dynamic memory allocation.
Definition AMReX_Arena.H:127
A STREAM-ordered memory arena.
Definition AMReX_SArena.H:31
bool isDevice() const final
Check whether it is non-managed GPU device memory.
Definition AMReX_SArena.cpp:48
bool isStreamOrderedArena() const final
Is this a GPU stream ordered memory allocator?
Definition AMReX_SArena.H:57
void * alloc(std::size_t sz) final
Allocates dynamic memory from the arena of size sz. Returns a pointer to this memory....
Definition AMReX_SArena.cpp:5
bool isManaged() const final
Check whether it is managed GPU memory.
Definition AMReX_SArena.cpp:42
bool isPinned() const final
Check whether it is pinned host memory.
Definition AMReX_SArena.cpp:54
void streamOrderedFree(void *pt, gpuStream_t stream) override
Definition AMReX_SArena.cpp:21
bool isDeviceAccessible() const final
Definition AMReX_SArena.cpp:30
void free(void *pt) final
Deletes the arena pointed to by pt. After this function is called, the memory can still be used by al...
Definition AMReX_SArena.cpp:13
bool isHostAccessible() const final
Definition AMReX_SArena.cpp:36
Definition AMReX_Amr.cpp:49
cudaStream_t gpuStream_t
Definition AMReX_GpuControl.H:83