From e74fe6cbb0a116fc39af9aabe1adca6fa51e0dd2 Mon Sep 17 00:00:00 2001 From: Ann Almgren Date: Sat, 16 Mar 2024 16:06:59 -0700 Subject: [PATCH] fix for GPU (#1501) --- Source/Initialization/ERF_init_from_wrfinput.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Initialization/ERF_init_from_wrfinput.cpp b/Source/Initialization/ERF_init_from_wrfinput.cpp index 3798a4060..a3a2bbc4e 100644 --- a/Source/Initialization/ERF_init_from_wrfinput.cpp +++ b/Source/Initialization/ERF_init_from_wrfinput.cpp @@ -485,8 +485,14 @@ verify_terrain_top_boundary (const Real& z_top, for (int idx = 0; idx < nboxes; idx++) { Gpu::HostVector MaxMax_h(2); Gpu::DeviceVector MaxMax_d; - MaxMax_d.push_back(-1.0e16); - MaxMax_d.push_back(-1.0e16); + MaxMax_d.resize(2); + MaxMax_h.push_back(-1.0e16); + MaxMax_h.push_back(-1.0e16); +#ifdef AMREX_USE_GPU + Gpu::htod_memcpy_async(MaxMax_d.data(), MaxMax_h.data(), sizeof(Real)*2); +#else + std::memcpy(MaxMax_d.data(), MaxMax_h.data(), sizeof(Real)*2); +#endif Real* mm_d = MaxMax_d.data(); Box Fab2dBox_hi (NC_PHB_fab[idx].box()); Fab2dBox_hi.makeSlab(2,Fab2dBox_hi.bigEnd(2));