Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_GpuContainers.H File Reference
#include <AMReX_Config.H>
#include <AMReX_Vector.H>
#include <AMReX_PODVector.H>
#include <AMReX_GpuAllocators.H>
#include <type_traits>
#include <numeric>
#include <iterator>

Go to the source code of this file.

Classes

struct  amrex::Gpu::HostToDevice
struct  amrex::Gpu::DeviceToHost
struct  amrex::Gpu::DeviceToDevice

Namespaces

namespace  amrex
namespace  amrex::Gpu

Typedefs

template<class T>
using amrex::Gpu::DeviceVector = PODVector<T, ArenaAllocator<T> >
 A PODVector that uses the standard memory Arena. Note that the memory might or might not be managed depending on the amrex.the_arena_is_managed ParmParse parameter.
template<class T>
using amrex::Gpu::NonManagedDeviceVector = PODVector<T, DeviceArenaAllocator<T> >
 A PODVector that uses the non-managed device memory arena.
template<class T>
using amrex::Gpu::ManagedVector = PODVector<T, ManagedArenaAllocator<T> >
 A PODVector that uses the managed memory arena.
template<class T>
using amrex::Gpu::PinnedVector = PODVector<T, PinnedArenaAllocator<T> >
 A PODVector that uses the pinned memory arena.
template<class T>
using amrex::Gpu::AsyncVector = PODVector<T, AsyncArenaAllocator<T> >
 A PODVector that uses the async memory arena. Maybe useful for temporary vectors inside MFIters that are accessed on the device.
template<class T>
using amrex::Gpu::HostVector = PinnedVector<T>
 A PODVector that uses pinned host memory. Same as PinnedVector. For a vector class that uses std::allocator by default, see amrex::Vector.
template<class T>
using amrex::Gpu::ManagedDeviceVector = PODVector<T, ManagedArenaAllocator<T> >
 This is identical to ManagedVector<T>. The ManagedDeviceVector form is deprecated and will be removed in a future release.

Functions

template<class InIter, class OutIter>
void amrex::Gpu::copy (HostToDevice, InIter begin, InIter end, OutIter result) noexcept
 A host-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous storage. The amrex-provided containers like Gpu::HostVector, Gpu::DeviceVector, etc. meet this requirement.
template<class InIter, class OutIter>
void amrex::Gpu::copy (DeviceToHost, InIter begin, InIter end, OutIter result) noexcept
 A device-to-host copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous storage. The amrex-provided containers like Gpu::HostVector, Gpu::DeviceVector, etc. meet this requirement.
template<class InIter, class OutIter>
void amrex::Gpu::copy (DeviceToDevice, InIter begin, InIter end, OutIter result) noexcept
 A device-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous storage. The amrex-provided containers like Gpu::HostVector, Gpu::DeviceVector, etc. meet this requirement.
template<class InIter, class OutIter>
void amrex::Gpu::copyAsync (HostToDevice, InIter begin, InIter end, OutIter result) noexcept
 A host-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous storage. The amrex-provided containers like Gpu::HostVector, Gpu::DeviceVector, etc. meet this requirement.
template<class InIter, class OutIter>
void amrex::Gpu::copyAsync (DeviceToHost, InIter begin, InIter end, OutIter result) noexcept
 A device-to-host copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous storage. The amrex-provided containers like Gpu::HostVector, Gpu::DeviceVector, etc. meet this requirement.
template<class InIter, class OutIter>
void amrex::Gpu::copyAsync (DeviceToDevice, InIter begin, InIter end, OutIter result) noexcept
 A device-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous storage. The amrex-provided containers like Gpu::HostVector, Gpu::DeviceVector, etc. meet this requirement.
template<class Iter>
void amrex::Gpu::prefetchToHost (Iter begin, Iter end) noexcept
 Migrate elements of a container from device to host. This is a no-op for host-only code.
template<class Iter>
void amrex::Gpu::prefetchToDevice (Iter begin, Iter end) noexcept
 Migrate elements of a container from host to device. This is a no-op for host-only code.
template<typename IT, typename F, typename T = typename std::iterator_traits<IT>::value_type>
requires ((sizeof(T) <= 36*8) && // so there is enough shared memory std::is_trivially_copyable_v<T> && amrex::IsCallable<F, T&, Long>::value)
void amrex::Gpu::fillAsync (IT first, IT last, F const &f) noexcept
 Fill the elements in the given range using the given calllable.

Variables

static constexpr HostToDevice amrex::Gpu::hostToDevice {}
static constexpr DeviceToHost amrex::Gpu::deviceToHost {}
static constexpr DeviceToDevice amrex::Gpu::deviceToDevice {}