1 #ifndef ERF_ACTUATOR_DEVICE_BUFFERS_H
2 #define ERF_ACTUATOR_DEVICE_BUFFERS_H
10 #include <AMReX_GpuContainers.H>
11 #include <AMReX_INT.H>
12 #include <AMReX_REAL.H>
20 if (v.size() < n) { v.resize(n); }
41 if (
host.empty()) {
return; }
43 amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice,
pinned.begin(),
pinned.begin() +
host.size(),
device.begin());
49 if (n == 0) {
return; }
50 amrex::Gpu::copyAsync(amrex::Gpu::deviceToHost,
device.begin(),
device.begin() + n,
pinned.begin());
@ T
Definition: ERF_IndexDefines.H:180
@ V
Definition: ERF_IndexDefines.H:179
Definition: ERF_ActuatorDeviceBuffers.H:14
void grow_buffer(V &v, std::size_t n)
Definition: ERF_ActuatorDeviceBuffers.H:18
Definition: ERF_ActuatorDeviceBuffers.H:61
StagedBuffer< int > sample_cnt
1 per point: how many of this rank's boxes hold it
Definition: ERF_ActuatorDeviceBuffers.H:75
StagedBuffer< amrex::Real > sample_vel
3 per point (m/s)
Definition: ERF_ActuatorDeviceBuffers.H:74
StagedBuffer< int > bins
Definition: ERF_ActuatorDeviceBuffers.H:71
StagedBuffer< int > image_point
1 per image: the point it is an image of
Definition: ERF_ActuatorDeviceBuffers.H:64
StagedBuffer< amrex::Real > point_eps
2 per point: 1 / eps^2 and the squared cut-off radius 9 eps^2
Definition: ERF_ActuatorDeviceBuffers.H:67
StagedBuffer< amrex::Real > scales
3 per point: F_p / S_p (add_scaled_kernels)
Definition: ERF_ActuatorDeviceBuffers.H:68
StagedBuffer< amrex::Real > norms
3 per point: the accumulators of S_p (spread_partial_norms)
Definition: ERF_ActuatorDeviceBuffers.H:69
bool force_face_major
Definition: ERF_ActuatorDeviceBuffers.H:81
StagedBuffer< int > image_reach
18 per image: per face grid, the faces within its reach (lo x y z, hi x y z)
Definition: ERF_ActuatorDeviceBuffers.H:65
amrex::Long kernel_launches
kernels launched through these buffers so far (for the tests)
Definition: ERF_ActuatorDeviceBuffers.H:77
StagedBuffer< amrex::Real > image_pos
3 per image: its position (m)
Definition: ERF_ActuatorDeviceBuffers.H:63
StagedBuffer< amrex::Real > sample_pos
3 per point (m)
Definition: ERF_ActuatorDeviceBuffers.H:73
Definition: ERF_ActuatorDeviceBuffers.H:31
void upload()
Definition: ERF_ActuatorDeviceBuffers.H:37
std::vector< T > host
what the next upload() sends
Definition: ERF_ActuatorDeviceBuffers.H:32
T * data()
Definition: ERF_ActuatorDeviceBuffers.H:52
void download_async(std::size_t n)
Definition: ERF_ActuatorDeviceBuffers.H:46
amrex::Gpu::DeviceVector< T > device
Definition: ERF_ActuatorDeviceBuffers.H:34
amrex::Gpu::PinnedVector< T > pinned
staging, and the host side of download_async()
Definition: ERF_ActuatorDeviceBuffers.H:33