3 #include <AMReX_Config.H>
22 template <
RunOn run_on,
typename T,
23 std::enable_if_t<std::is_same_v<T,double> || std::is_same_v<T,float>,
int> FOO = 0>
26 if (p ==
nullptr || nelems == 0) {
return; }
31 p[i] = std::numeric_limits<T>::signaling_NaN();
36 if constexpr (std::is_same_v<T,float>) {
38 const uint32_t snan = UINT32_C(0x7fa00000);
39 static_assert(
sizeof(
float) ==
sizeof(uint32_t),
"MemPool: sizeof float != sizeof uint32_t");
40 for (
size_t i = 0; i < nelems; ++i) {
44 }
else if constexpr (std::is_same_v<T,double>) {
46 const uint64_t snan = UINT64_C(0x7ff0000080000001);
47 static_assert(
sizeof(
double) ==
sizeof(uint64_t),
"MemPool: sizeof double != sizeof uint64_t");
48 for (
size_t i = 0; i < nelems; ++i) {
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
void amrex_mempool_free(void *p)
Definition: AMReX_MemPool.cpp:80
void amrex_mempool_init()
Definition: AMReX_MemPool.cpp:31
void amrex_array_init_snan(amrex_real *p, size_t nelems)
void amrex_mempool_get_stats(int &mp_min, int &mp_max, int &mp_tot)
min, max & tot in MB
Definition: AMReX_MemPool.cpp:86
void amrex_mempool_finalize()
Definition: AMReX_MemPool.cpp:68
void * amrex_mempool_alloc(size_t n)
Definition: AMReX_MemPool.cpp:74
void amrex_real_array_init(amrex_real *p, size_t nelems)
double amrex_real
Definition: AMReX_REAL.H:55
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
Definition: AMReX_Amr.cpp:49
std::enable_if_t< std::is_integral_v< T > > ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition: AMReX_CTOParallelForImpl.H:200
RunOn
Definition: AMReX_GpuControl.H:69
void fill_snan(T *p, std::size_t nelems)
Definition: AMReX_MemPool.H:24