1 #ifndef AMREX_GPU_DEVICE_BUFFER_H_
2 #define AMREX_GPU_DEVICE_BUFFER_H_
3 #include <AMReX_Config.H>
10 #include <initializer_list>
15 template <
typename T, std::enable_if_t<std::is_trivially_copyable_v<T>,
int> = 0>
20 Buffer (std::initializer_list<T> init)
23 if (
m_size == 0) {
return; }
39 Buffer (T
const* h_p,
const std::size_t n)
42 if (
m_size == 0) {
return; }
71 [[nodiscard]] std::size_t
size () const noexcept {
return m_size; }
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_GpuBuffer.H:17
void operator=(Buffer const &)=delete
void clear()
Definition: AMReX_GpuBuffer.H:73
~Buffer()
Definition: AMReX_GpuBuffer.H:58
T * hostData() noexcept
Definition: AMReX_GpuBuffer.H:69
T const * data() const noexcept
Definition: AMReX_GpuBuffer.H:65
Buffer(std::initializer_list< T > init)
Definition: AMReX_GpuBuffer.H:20
Buffer(Buffer const &)=delete
T * d_data
Definition: AMReX_GpuBuffer.H:99
Buffer(T const *h_p, const std::size_t n)
Definition: AMReX_GpuBuffer.H:39
T * copyToHost()
Definition: AMReX_GpuBuffer.H:85
T const * hostData() const noexcept
Definition: AMReX_GpuBuffer.H:68
T * data() noexcept
Definition: AMReX_GpuBuffer.H:66
std::size_t size() const noexcept
Definition: AMReX_GpuBuffer.H:71
std::size_t m_size
Definition: AMReX_GpuBuffer.H:98
T * h_data
Definition: AMReX_GpuBuffer.H:100
Definition: AMReX_BaseFwd.H:52
void streamSynchronize() noexcept
Definition: AMReX_GpuDevice.H:237
void dtoh_memcpy_async(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:265
bool inLaunchRegion() noexcept
Definition: AMReX_GpuControl.H:86
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void * memcpy(void *dest, const void *src, std::size_t count)
Definition: AMReX_GpuUtility.H:214
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:251
Arena * The_Pinned_Arena()
Definition: AMReX_Arena.cpp:649
Arena * The_Arena()
Definition: AMReX_Arena.cpp:609