Block-Structured AMR Software Framework
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

 amrex
 
 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. More...
 
template<class T >
using amrex::Gpu::NonManagedDeviceVector = PODVector< T, DeviceArenaAllocator< T > >
 A PODVector that uses the non-managed device memory arena. More...
 
template<class T >
using amrex::Gpu::ManagedVector = PODVector< T, ManagedArenaAllocator< T > >
 A PODVector that uses the managed memory arena. More...
 
template<class T >
using amrex::Gpu::PinnedVector = PODVector< T, PinnedArenaAllocator< T > >
 A PODVector that uses the pinned memory arena. More...
 
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. More...
 
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. More...
 
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. More...
 

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename IT , typename F , typename T = typename std::iterator_traits<IT>::value_type, std::enable_if_t<(sizeof(T)<=36 *8) &&std::is_trivially_copyable_v< T > &&amrex::IsCallable< F, T &, Long >::value, int > FOO = 0>
void amrex::Gpu::fillAsync (IT first, IT last, F const &f) noexcept
 Fill the elements in the given range using the given calllable. More...
 

Variables

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