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<cms::alpakatools::is_queue_v<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<cms::alpakatools::is_device_v<TDev>>>
class PortableDeviceCollection< T, TDev, typename >

Definition at line 14 of file PortableDeviceCollection.h.

Member Typedef Documentation

◆ Buffer

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

Definition at line 22 of file PortableDeviceCollection.h.

◆ ConstBuffer

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

Definition at line 23 of file PortableDeviceCollection.h.

◆ ConstView

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
using PortableDeviceCollection< T, TDev, typename >::ConstView = typename Layout::ConstView

Definition at line 21 of file PortableDeviceCollection.h.

◆ Layout

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
using PortableDeviceCollection< T, TDev, typename >::Layout = T

Definition at line 19 of file PortableDeviceCollection.h.

◆ View

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
using PortableDeviceCollection< T, TDev, typename >::View = typename Layout::View

Definition at line 20 of file PortableDeviceCollection.h.

Constructor & Destructor Documentation

◆ PortableDeviceCollection() [1/5]

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
PortableDeviceCollection< T, TDev, typename >::PortableDeviceCollection ( )
default

◆ PortableDeviceCollection() [2/5]

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

Definition at line 27 of file PortableDeviceCollection.h.

References bookConverter::elements.

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

◆ PortableDeviceCollection() [3/5]

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
template<typename TQueue , typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
PortableDeviceCollection< T, TDev, typename >::PortableDeviceCollection ( int32_t  elements,
TQueue const &  queue 
)
inline

Definition at line 36 of file PortableDeviceCollection.h.

References bookConverter::elements, and createBeamHaloJobs::queue.

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

◆ PortableDeviceCollection() [4/5]

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<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<cms::alpakatools::is_device_v<TDev>>>
PortableDeviceCollection< T, TDev, typename >::PortableDeviceCollection ( PortableDeviceCollection< T, TDev, typename > &&  )
default

◆ ~PortableDeviceCollection()

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
PortableDeviceCollection< T, TDev, typename >::~PortableDeviceCollection ( )
default

Member Function Documentation

◆ buffer() [1/2]

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
Buffer PortableDeviceCollection< T, TDev, typename >::buffer ( )
inline

Definition at line 67 of file PortableDeviceCollection.h.

References PortableDeviceCollection< T, TDev, typename >::buffer_.

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

◆ buffer() [2/2]

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
ConstBuffer PortableDeviceCollection< T, TDev, typename >::buffer ( ) const
inline

Definition at line 68 of file PortableDeviceCollection.h.

References PortableDeviceCollection< T, TDev, typename >::buffer_.

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

◆ const_buffer()

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
ConstBuffer PortableDeviceCollection< T, TDev, typename >::const_buffer ( ) const
inline

◆ const_view()

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
ConstView const& PortableDeviceCollection< T, TDev, typename >::const_view ( ) const
inline

◆ operator*() [1/2]

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

◆ operator*() [2/2]

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

◆ operator->() [1/2]

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
View* PortableDeviceCollection< T, TDev, typename >::operator-> ( )
inline

◆ operator->() [2/2]

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

◆ operator=() [1/2]

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<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<cms::alpakatools::is_device_v<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<cms::alpakatools::is_device_v<TDev>>>
View& PortableDeviceCollection< T, TDev, typename >::view ( )
inline

◆ view() [2/2]

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
ConstView const& PortableDeviceCollection< T, TDev, typename >::view ( ) const
inline

Member Data Documentation

◆ buffer_

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
std::optional<Buffer> PortableDeviceCollection< T, TDev, typename >::buffer_
private

◆ layout_

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
Layout PortableDeviceCollection< T, TDev, typename >::layout_
private

Definition at line 73 of file PortableDeviceCollection.h.

◆ view_

template<typename T , typename TDev , typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev>>>
View PortableDeviceCollection< T, TDev, typename >::view_
private