CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
PortableDeviceCollection< T, TDev, typename > Class Template Reference

#include <PortableDeviceCollection.h>

Public Types

using Buffer = cms::alpakatools::device_buffer< TDev, std::byte[]>
 
using ConstBuffer = cms::alpakatools::const_device_buffer< TDev, std::byte[]>
 
using ConstView = typename Layout::ConstView
 
using Layout = T
 
using View = typename Layout::View
 

Public Member Functions

Buffer buffer ()
 
ConstBuffer buffer () const
 
ConstBuffer const_buffer () const
 
ConstView const & const_view () const
 
Viewoperator* ()
 
ConstView const & operator* () const
 
Viewoperator-> ()
 
ConstView const * operator-> () const
 
PortableDeviceCollectionoperator= (PortableDeviceCollection const &)=delete
 
PortableDeviceCollectionoperator= (PortableDeviceCollection &&)=default
 
 PortableDeviceCollection ()=default
 
 PortableDeviceCollection (int32_t elements, TDev const &device)
 
template<typename TQueue , typename = std::enable_if_t<alpaka::isQueue<TQueue>>>
 PortableDeviceCollection (int32_t elements, TQueue const &queue)
 
 PortableDeviceCollection (PortableDeviceCollection const &)=delete
 
 PortableDeviceCollection (PortableDeviceCollection &&)=default
 
Viewview ()
 
ConstView const & view () const
 
 ~PortableDeviceCollection ()=default
 

Private Attributes

std::optional< Bufferbuffer_
 
Layout layout_
 
View view_
 

Detailed Description

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
class PortableDeviceCollection< T, TDev, typename >

Definition at line 16 of file PortableDeviceCollection.h.

Member Typedef Documentation

◆ Buffer

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
using PortableDeviceCollection< T, TDev, typename >::Buffer = cms::alpakatools::device_buffer<TDev, std::byte[]>

Definition at line 24 of file PortableDeviceCollection.h.

◆ ConstBuffer

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
using PortableDeviceCollection< T, TDev, typename >::ConstBuffer = cms::alpakatools::const_device_buffer<TDev, std::byte[]>

Definition at line 25 of file PortableDeviceCollection.h.

◆ ConstView

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
using PortableDeviceCollection< T, TDev, typename >::ConstView = typename Layout::ConstView

Definition at line 23 of file PortableDeviceCollection.h.

◆ Layout

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
using PortableDeviceCollection< T, TDev, typename >::Layout = T

Definition at line 21 of file PortableDeviceCollection.h.

◆ View

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
using PortableDeviceCollection< T, TDev, typename >::View = typename Layout::View

Definition at line 22 of file PortableDeviceCollection.h.

Constructor & Destructor Documentation

◆ PortableDeviceCollection() [1/5]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
PortableDeviceCollection< T, TDev, typename >::PortableDeviceCollection ( )
default

◆ PortableDeviceCollection() [2/5]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
PortableDeviceCollection< T, TDev, typename >::PortableDeviceCollection ( int32_t  elements,
TDev const &  device 
)
inline

Definition at line 29 of file PortableDeviceCollection.h.

30  : buffer_{cms::alpakatools::make_device_buffer<std::byte[]>(device, Layout::computeDataSize(elements))},
31  layout_{buffer_->data(), elements},
32  view_{layout_} {
33  // Alpaka set to a default alignment of 128 bytes defining ALPAKA_DEFAULT_HOST_MEMORY_ALIGNMENT=128
34  assert(reinterpret_cast<uintptr_t>(buffer_->data()) % Layout::alignment == 0);
35  }
assert(be >=bs)
std::optional< Buffer > buffer_

◆ PortableDeviceCollection() [3/5]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
template<typename TQueue , typename = std::enable_if_t<alpaka::isQueue<TQueue>>>
PortableDeviceCollection< T, TDev, typename >::PortableDeviceCollection ( int32_t  elements,
TQueue const &  queue 
)
inline

Definition at line 38 of file PortableDeviceCollection.h.

39  : buffer_{cms::alpakatools::make_device_buffer<std::byte[]>(queue, Layout::computeDataSize(elements))},
40  layout_{buffer_->data(), elements},
41  view_{layout_} {
42  // Alpaka set to a default alignment of 128 bytes defining ALPAKA_DEFAULT_HOST_MEMORY_ALIGNMENT=128
43  assert(reinterpret_cast<uintptr_t>(buffer_->data()) % Layout::alignment == 0);
44  }
assert(be >=bs)
std::optional< Buffer > buffer_

◆ PortableDeviceCollection() [4/5]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
PortableDeviceCollection< T, TDev, typename >::PortableDeviceCollection ( PortableDeviceCollection< T, TDev, typename > const &  )
delete

◆ PortableDeviceCollection() [5/5]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
PortableDeviceCollection< T, TDev, typename >::PortableDeviceCollection ( PortableDeviceCollection< T, TDev, typename > &&  )
default

◆ ~PortableDeviceCollection()

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
PortableDeviceCollection< T, TDev, typename >::~PortableDeviceCollection ( )
default

Member Function Documentation

◆ buffer() [1/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
Buffer PortableDeviceCollection< T, TDev, typename >::buffer ( )
inline

◆ buffer() [2/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
ConstBuffer PortableDeviceCollection< T, TDev, typename >::buffer ( ) const
inline

Definition at line 70 of file PortableDeviceCollection.h.

70 { return *buffer_; }
std::optional< Buffer > buffer_

◆ const_buffer()

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
ConstBuffer PortableDeviceCollection< T, TDev, typename >::const_buffer ( ) const
inline

Definition at line 71 of file PortableDeviceCollection.h.

71 { return *buffer_; }
std::optional< Buffer > buffer_

◆ const_view()

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
ConstView const& PortableDeviceCollection< T, TDev, typename >::const_view ( ) const
inline

Definition at line 60 of file PortableDeviceCollection.h.

◆ operator*() [1/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
View& PortableDeviceCollection< T, TDev, typename >::operator* ( void  )
inline

Definition at line 62 of file PortableDeviceCollection.h.

◆ operator*() [2/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
ConstView const& PortableDeviceCollection< T, TDev, typename >::operator* ( void  ) const
inline

Definition at line 63 of file PortableDeviceCollection.h.

◆ operator->() [1/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
View* PortableDeviceCollection< T, TDev, typename >::operator-> ( )
inline

Definition at line 65 of file PortableDeviceCollection.h.

◆ operator->() [2/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
ConstView const* PortableDeviceCollection< T, TDev, typename >::operator-> ( ) const
inline

Definition at line 66 of file PortableDeviceCollection.h.

◆ operator=() [1/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
PortableDeviceCollection& PortableDeviceCollection< T, TDev, typename >::operator= ( PortableDeviceCollection< T, TDev, typename > const &  )
delete

◆ operator=() [2/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
PortableDeviceCollection& PortableDeviceCollection< T, TDev, typename >::operator= ( PortableDeviceCollection< T, TDev, typename > &&  )
default

◆ view() [1/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
View& PortableDeviceCollection< T, TDev, typename >::view ( )
inline

Definition at line 58 of file PortableDeviceCollection.h.

◆ view() [2/2]

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
ConstView const& PortableDeviceCollection< T, TDev, typename >::view ( ) const
inline

Definition at line 59 of file PortableDeviceCollection.h.

Member Data Documentation

◆ buffer_

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
std::optional<Buffer> PortableDeviceCollection< T, TDev, typename >::buffer_
private

◆ layout_

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
Layout PortableDeviceCollection< T, TDev, typename >::layout_
private

Definition at line 75 of file PortableDeviceCollection.h.

◆ view_

template<typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>>
View PortableDeviceCollection< T, TDev, typename >::view_
private