1 #ifndef AMREX_GPU_MEMORY_H_
2 #define AMREX_GPU_MEMORY_H_
3 #include <AMReX_Config.H>
18 [[nodiscard]]
void *
operator new (std::size_t len)
23 void operator delete (
void *ptr)
35 [[nodiscard]]
void *
operator new (std::size_t len)
40 void operator delete (
void *ptr)
54 template <
class T, std::enable_if_t<std::is_trivially_copyable_v<T>,
int> = 0>
91 [[nodiscard]] T
const*
dataPtr ()
const {
return dp; }
111 [[nodiscard]] T*
dataPtr () {
return &d; }
112 [[nodiscard]] T
const*
dataPtr ()
const {
return &d; }
113 [[nodiscard]] T
dataValue ()
const {
return d; }
127 static_assert(
sizeof(T) < 0,
"We must specialize struct SharedMemory");
132 #ifndef AMREX_USE_SYCL
140 extern __shared__
double amrex_sm_double[];)
141 return amrex_sm_double;
150 extern __shared__
float amrex_sm_float[];)
151 return amrex_sm_float;
160 extern __shared__
long amrex_sm_long[];)
161 return amrex_sm_long;
170 extern __shared__
long long amrex_sm_long_long[];)
171 return amrex_sm_long_long;
180 extern __shared__
int amrex_sm_int[];)
190 extern __shared__
short amrex_sm_short[];)
191 return amrex_sm_short;
200 extern __shared__
char amrex_sm_char[];)
201 return amrex_sm_char;
210 extern __shared__
unsigned long amrex_sm_ulong[];)
211 return amrex_sm_ulong;
220 extern __shared__
unsigned long long amrex_sm_ulonglong[];)
221 return amrex_sm_ulonglong;
230 extern __shared__
unsigned int amrex_sm_uint[];)
231 return amrex_sm_uint;
240 extern __shared__
unsigned short amrex_sm_ushort[];)
241 return amrex_sm_ushort;
250 extern __shared__
unsigned char amrex_sm_uchar[];)
251 return amrex_sm_uchar;
260 extern __shared__
bool amrex_sm_bool[];)
261 return amrex_sm_bool;
#define AMREX_HIP_OR_CUDA(a, b)
Definition: AMReX_GpuControl.H:21
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
A virtual base class for objects that manage their own dynamic memory allocation.
Definition: AMReX_Arena.H:100
virtual void free(void *pt)=0
A pure virtual function for deleting the arena pointed to by pt.
virtual void * alloc(std::size_t sz)=0
Definition: AMReX_BaseFwd.H:52
bool inLaunchRegion() noexcept
Definition: AMReX_GpuControl.H:86
void dtoh_memcpy(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:301
void htod_memcpy(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:293
Arena * The_Managed_Arena()
Definition: AMReX_Arena.cpp:639
Arena * The_Pinned_Arena()
Definition: AMReX_Arena.cpp:649
const int[]
Definition: AMReX_BLProfiler.cpp:1664
Arena * The_Arena()
Definition: AMReX_Arena.cpp:609
Definition: AMReX_GpuMemory.H:48
Deleter(Arena *ar) noexcept
Definition: AMReX_GpuMemory.H:50
void operator()(void *pt) const noexcept
Definition: AMReX_GpuMemory.H:51
Arena * m_arena
Definition: AMReX_GpuMemory.H:49
Definition: AMReX_GpuMemory.H:56
DeviceScalar()
Definition: AMReX_GpuMemory.H:64
T dataValue() const
Definition: AMReX_GpuMemory.H:92
void operator=(DeviceScalar const &)=delete
DeviceScalar(DeviceScalar const &)=delete
T * dataPtr()
Definition: AMReX_GpuMemory.H:90
DeviceScalar(DeviceScalar &&)=delete
T const * dataPtr() const
Definition: AMReX_GpuMemory.H:91
DeviceScalar(T init_val)
Definition: AMReX_GpuMemory.H:72
~DeviceScalar()
Definition: AMReX_GpuMemory.H:82
T * dp
Definition: AMReX_GpuMemory.H:103
Definition: AMReX_GpuMemory.H:14
Definition: AMReX_GpuMemory.H:31
AMREX_GPU_DEVICE bool * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:258
AMREX_GPU_DEVICE char * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:198
AMREX_GPU_DEVICE double * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:138
AMREX_GPU_DEVICE float * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:148
AMREX_GPU_DEVICE int * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:178
AMREX_GPU_DEVICE long * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:158
AMREX_GPU_DEVICE long long * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:168
AMREX_GPU_DEVICE short * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:188
AMREX_GPU_DEVICE unsigned char * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:248
AMREX_GPU_DEVICE unsigned int * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:228
AMREX_GPU_DEVICE unsigned long * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:208
AMREX_GPU_DEVICE unsigned long long * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:218
AMREX_GPU_DEVICE unsigned short * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:238
Definition: AMReX_GpuMemory.H:125
AMREX_GPU_DEVICE T * dataPtr() noexcept
Definition: AMReX_GpuMemory.H:126