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 15 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 23 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 24 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 22 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 20 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 21 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 28 of file PortableDeviceCollection.h.

References bookConverter::elements.

29  : buffer_{cms::alpakatools::make_device_buffer<std::byte[]>(device, Layout::computeDataSize(elements))},
30  layout_{buffer_->data(), elements},
31  view_{layout_} {
32  // Alpaka set to a default alignment of 128 bytes defining ALPAKA_DEFAULT_HOST_MEMORY_ALIGNMENT=128
33  assert(reinterpret_cast<uintptr_t>(buffer_->data()) % Layout::alignment == 0);
34  }
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 37 of file PortableDeviceCollection.h.

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

38  : buffer_{cms::alpakatools::make_device_buffer<std::byte[]>(queue, Layout::computeDataSize(elements))},
39  layout_{buffer_->data(), elements},
40  view_{layout_} {
41  // Alpaka set to a default alignment of 128 bytes defining ALPAKA_DEFAULT_HOST_MEMORY_ALIGNMENT=128
42  assert(reinterpret_cast<uintptr_t>(buffer_->data()) % Layout::alignment == 0);
43  }
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 69 of file PortableDeviceCollection.h.

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

69 { 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

◆ 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

◆ operator*() [1/2]

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

◆ 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

◆ operator->() [1/2]

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

◆ 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

◆ 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

◆ 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

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 74 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