CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
PortableHostObject< T > Class Template Reference

#include <PortableHostObject.h>

Public Types

using Buffer = cms::alpakatools::host_buffer< Product >
 
using ConstBuffer = cms::alpakatools::const_host_buffer< Product >
 
using Product = T
 

Public Member Functions

Buffer buffer ()
 
ConstBuffer buffer () const
 
ConstBuffer const_buffer () const
 
Product const * const_data () const
 
Product const & const_value () const
 
Productdata ()
 
Product const * data () const
 
Productoperator* ()
 
Product const & operator* () const
 
Productoperator-> ()
 
Product const * operator-> () const
 
PortableHostObjectoperator= (PortableHostObject const &)=delete
 
PortableHostObjectoperator= (PortableHostObject &&)=default
 
 PortableHostObject ()=default
 
 PortableHostObject (alpaka_common::DevHost const &host)
 
template<typename TQueue , typename = std::enable_if_t<alpaka::isQueue<TQueue>>>
 PortableHostObject (TQueue const &queue)
 
 PortableHostObject (PortableHostObject const &)=delete
 
 PortableHostObject (PortableHostObject &&)=default
 
Productvalue ()
 
Product const & value () const
 
void zeroInitialise ()
 
template<typename TQueue , typename = std::enable_if_t<alpaka::isQueue<TQueue>>>
void zeroInitialise (TQueue &&queue)
 
 ~PortableHostObject ()=default
 

Static Public Member Functions

static void ROOTReadStreamer (PortableHostObject *newObj, Product &product)
 

Private Attributes

std::optional< Bufferbuffer_
 
Productproduct_
 

Detailed Description

template<typename T>
class PortableHostObject< T >

Definition at line 16 of file PortableHostObject.h.

Member Typedef Documentation

◆ Buffer

Definition at line 19 of file PortableHostObject.h.

◆ ConstBuffer

Definition at line 20 of file PortableHostObject.h.

◆ Product

template<typename T>
using PortableHostObject< T >::Product = T

Definition at line 18 of file PortableHostObject.h.

Constructor & Destructor Documentation

◆ PortableHostObject() [1/5]

template<typename T>
PortableHostObject< T >::PortableHostObject ( )
default

◆ PortableHostObject() [2/5]

template<typename T>
PortableHostObject< T >::PortableHostObject ( alpaka_common::DevHost const &  host)
inline

Definition at line 24 of file PortableHostObject.h.

26  : buffer_{cms::alpakatools::make_host_buffer<Product>()}, product_{buffer_->data()} {
27  assert(reinterpret_cast<uintptr_t>(product_) % alignof(Product) == 0);
28  }
std::optional< Buffer > buffer_
assert(be >=bs)

◆ PortableHostObject() [3/5]

template<typename T>
template<typename TQueue , typename = std::enable_if_t<alpaka::isQueue<TQueue>>>
PortableHostObject< T >::PortableHostObject ( TQueue const &  queue)
inline

Definition at line 31 of file PortableHostObject.h.

References createBeamHaloJobs::queue.

33  : buffer_{cms::alpakatools::make_host_buffer<Product>(queue)}, product_{buffer_->data()} {
34  assert(reinterpret_cast<uintptr_t>(product_) % alignof(Product) == 0);
35  }
std::optional< Buffer > buffer_
assert(be >=bs)

◆ PortableHostObject() [4/5]

template<typename T>
PortableHostObject< T >::PortableHostObject ( PortableHostObject< T > const &  )
delete

◆ PortableHostObject() [5/5]

template<typename T>
PortableHostObject< T >::PortableHostObject ( PortableHostObject< T > &&  )
default

◆ ~PortableHostObject()

template<typename T>
PortableHostObject< T >::~PortableHostObject ( )
default

Member Function Documentation

◆ buffer() [1/2]

template<typename T>
Buffer PortableHostObject< T >::buffer ( )
inline

◆ buffer() [2/2]

template<typename T>
ConstBuffer PortableHostObject< T >::buffer ( ) const
inline

Definition at line 65 of file PortableHostObject.h.

References PortableHostObject< T >::buffer_.

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

◆ const_buffer()

template<typename T>
ConstBuffer PortableHostObject< T >::const_buffer ( ) const
inline

Definition at line 66 of file PortableHostObject.h.

References PortableHostObject< T >::buffer_.

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

◆ const_data()

template<typename T>
Product const* PortableHostObject< T >::const_data ( ) const
inline

Definition at line 55 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

55 { return product_; }

◆ const_value()

template<typename T>
Product const& PortableHostObject< T >::const_value ( ) const
inline

Definition at line 51 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

51 { return *product_; }

◆ data() [1/2]

template<typename T>
Product* PortableHostObject< T >::data ( )
inline

Definition at line 53 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

Referenced by TestAlpakaObjectAnalyzer::analyze().

53 { return product_; }

◆ data() [2/2]

template<typename T>
Product const* PortableHostObject< T >::data ( ) const
inline

Definition at line 54 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

54 { return product_; }

◆ operator*() [1/2]

template<typename T>
Product& PortableHostObject< T >::operator* ( void  )
inline

Definition at line 57 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

57 { return *product_; }

◆ operator*() [2/2]

template<typename T>
Product const& PortableHostObject< T >::operator* ( void  ) const
inline

Definition at line 58 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

58 { return *product_; }

◆ operator->() [1/2]

template<typename T>
Product* PortableHostObject< T >::operator-> ( )
inline

Definition at line 60 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

60 { return product_; }

◆ operator->() [2/2]

template<typename T>
Product const* PortableHostObject< T >::operator-> ( ) const
inline

Definition at line 61 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

61 { return product_; }

◆ operator=() [1/2]

template<typename T>
PortableHostObject& PortableHostObject< T >::operator= ( PortableHostObject< T > const &  )
delete

◆ operator=() [2/2]

template<typename T>
PortableHostObject& PortableHostObject< T >::operator= ( PortableHostObject< T > &&  )
default

◆ ROOTReadStreamer()

template<typename T>
static void PortableHostObject< T >::ROOTReadStreamer ( PortableHostObject< T > *  newObj,
Product product 
)
inlinestatic

Definition at line 79 of file PortableHostObject.h.

References cms::alpakatools::host(), PortableHostObject< T >::PortableHostObject(), PortableHostObject< T >::product_, and PortableHostObject< T >::~PortableHostObject().

79  {
80  // destroy the default-constructed object
81  newObj->~PortableHostObject();
82  // use the global "host" object returned by cms::alpakatools::host()
84  // copy the data from the on-file object to the new one
85  std::memcpy(newObj->product_, &product, sizeof(Product));
86  }
PortableHostObject()=default
alpaka::DevCpu const & host()
Definition: host.h:14
~PortableHostObject()=default

◆ value() [1/2]

template<typename T>
Product& PortableHostObject< T >::value ( )
inline

◆ value() [2/2]

template<typename T>
Product const& PortableHostObject< T >::value ( ) const
inline

◆ zeroInitialise() [1/2]

template<typename T>
void PortableHostObject< T >::zeroInitialise ( )
inline

Definition at line 69 of file PortableHostObject.h.

References PortableHostObject< T >::buffer_, and data.

69  {
70  std::memset(std::data(*buffer_), 0x00, alpaka::getExtentProduct(*buffer_) * sizeof(std::byte));
71  }
std::optional< Buffer > buffer_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80

◆ zeroInitialise() [2/2]

template<typename T>
template<typename TQueue , typename = std::enable_if_t<alpaka::isQueue<TQueue>>>
void PortableHostObject< T >::zeroInitialise ( TQueue &&  queue)
inline

Definition at line 74 of file PortableHostObject.h.

References PortableHostObject< T >::buffer_, and createBeamHaloJobs::queue.

74  {
75  alpaka::memset(std::forward<TQueue>(queue), *buffer_, 0x00);
76  }
std::optional< Buffer > buffer_

Member Data Documentation

◆ buffer_

template<typename T>
std::optional<Buffer> PortableHostObject< T >::buffer_
private

◆ product_

template<typename T>
Product* PortableHostObject< T >::product_
private