22 template<
typename TDev,
typename TElem,
typename TDim,
typename TIdx,
typename TSfinae =
void>
26 template<
typename TDev,
typename TElem,
typename TDim,
typename TIdx,
typename TSfinae =
void>
30 template<
typename TElem,
typename TDim,
typename TIdx,
typename TDev,
typename TSfinae =
void>
34 template<
typename TElem,
typename TDim,
typename TIdx,
typename TDev,
typename TSfinae =
void>
38 template<
typename TDim,
typename TDev>
44 template<
typename TPlatform,
typename TElem,
typename TDim,
typename TIdx>
48 template<
typename TPlatform>
54 template<
typename TPlatform,
typename TElem,
typename TDim,
typename TIdx>
58 template<
typename TBuf>
64 template<
typename TDev,
typename TElem,
typename TDim,
typename TIdx>
68 template<
typename TDev,
typename TElem,
typename TDim,
typename TIdx>
79 template<
typename TElem,
typename TIdx =
void,
typename TExtent =
void,
typename TDev =
void>
82 using Idx = std::conditional_t<std::is_void_v<TIdx>,
Idx<TExtent>, TIdx>;
96 template<
typename TElem,
typename TIdx =
void,
typename TExtent =
void,
typename TQueue =
void>
99 using Idx = std::conditional_t<std::is_void_v<TIdx>,
Idx<TExtent>, TIdx>;
107# pragma clang diagnostic push
108# pragma clang diagnostic ignored "-Wdocumentation"
114 template<
typename TDev,
typename TDim>
117# pragma clang diagnostic pop
133 template<
typename TElem,
typename TIdx =
void,
typename TExtent =
void,
typename TQueue =
void>
136 using Idx = std::conditional_t<std::is_void_v<TIdx>,
Idx<TExtent>, TIdx>;
138 if constexpr(hasAsyncBufSupport<alpaka::Dev<TQueue>,
Dim<TExtent>>)
140 return allocAsyncBuf<TElem, Idx>(queue, extent);
144 return allocBuf<TElem, Idx>(
getDev(queue), extent);
159 template<
typename TElem,
typename TIdx =
void,
typename TExtent =
void,
typename TPlatform =
void>
162 TPlatform
const& platform,
163 TExtent
const& extent = TExtent())
165 using Idx = std::conditional_t<std::is_void_v<TIdx>,
Idx<TExtent>, TIdx>;
179 template<
typename TElem,
typename TIdx =
void,
typename TExtent =
void,
typename TPlatform =
void>
182 TPlatform
const& platform,
183 TExtent
const& extent = TExtent())
185 using Idx = std::conditional_t<std::is_void_v<TIdx>,
Idx<TExtent>, TIdx>;
193# pragma clang diagnostic push
194# pragma clang diagnostic ignored "-Wdocumentation"
199 template<
typename TPlatform>
202# pragma clang diagnostic pop
218 template<
typename TElem,
typename TIdx =
void,
typename TExtent =
void,
typename TPlatform =
void>
221 TPlatform
const& platform,
222 TExtent
const& extent = TExtent())
224 using Idx = std::conditional_t<std::is_void_v<TIdx>,
Idx<TExtent>, TIdx>;
227 if constexpr(hasMappedBufSupport<Platform>)
229 return allocMappedBuf<TElem, Idx>(host, platform, extent);
233 return allocBuf<TElem, Idx>(host, extent);
244 template<
typename TBuf>
250 template<
typename TBuf>
#define ALPAKA_UNREACHABLE(...)
Before CUDA 11.5 nvcc is unable to correctly identify return statements in 'if constexpr' branches....
The alpaka accelerator library.
typename trait::IdxType< T >::type Idx
constexpr bool hasMappedBufSupport
Checks if the host can allocate a pinned/mapped host memory, accessible by all devices in the given p...
ALPAKA_FN_HOST auto allocManagedBuf(DevCpu const &host, TPlatform const &platform, TExtent const &extent=TExtent())
Allocates unified/managed memory, accessible by all devices in the given platform.
ALPAKA_FN_HOST auto allocAsyncBufIfSupported(TQueue queue, TExtent const &extent=TExtent())
If supported, allocates stream-ordered memory on the given queue and the associated device....
typename trait::DevType< T >::type Dev
The device type trait alias template to remove the ::type.
ALPAKA_FN_HOST auto makeConstBuf(TBuf const &buf)
Creates a constant buffer from the given mutable buffer.
ALPAKA_FN_HOST auto allocMappedBuf(DevCpu const &host, TPlatform const &platform, TExtent const &extent=TExtent())
Allocates pinned/mapped host memory, accessible by all devices in the given platform.
ALPAKA_FN_HOST auto allocBuf(TDev const &dev, TExtent const &extent=TExtent())
Allocates memory on the given device.
constexpr bool hasAsyncBufSupport
Checks if the given device can allocate a stream-ordered memory buffer of the given dimensionality.
ALPAKA_FN_HOST auto getDev(T const &t)
ALPAKA_FN_HOST auto allocMappedBufIfSupported(DevCpu const &host, TPlatform const &platform, TExtent const &extent=TExtent())
If supported, allocates pinned/mapped host memory, accessible by all devices in the given platform....
typename trait::BufType< alpaka::Dev< TDev >, TElem, TDim, TIdx >::type Buf
The memory buffer type trait alias template to remove the ::type for a Buffer type.
typename trait::ConstBufType< alpaka::Dev< TDev >, TElem, TDim, TIdx >::type ConstBuf
The memory buffer type trait alias template to remove the ::type for a ConstBuffer type.
ALPAKA_FN_HOST auto allocAsyncBuf(TQueue queue, TExtent const &extent=TExtent())
Allocates stream-ordered memory on the given device.
typename trait::PlatformType< T >::type Platform
The platform type trait alias template to remove the ::type.
typename trait::DimType< T >::type Dim
The dimension type trait alias template to remove the ::type.
The stream-ordered memory allocator trait.
The managed (unified) memory allocator trait.
The pinned/mapped memory allocator trait.
The memory allocator trait.
The memory buffer type trait.
The memory const-buffer type trait.
The stream-ordered memory allocation capability trait.
The pinned/mapped memory allocation capability trait.
The trait to transform a mutable buffer into a constant one.