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
 
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
 
 ~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 63 of file PortableHostObject.h.

References PortableHostObject< T >::buffer_.

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

◆ const_buffer()

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

Definition at line 64 of file PortableHostObject.h.

References PortableHostObject< T >::buffer_.

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

◆ data() [1/2]

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

Definition at line 52 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

Referenced by TestAlpakaObjectAnalyzer::analyze().

52 { return product_; }

◆ data() [2/2]

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

Definition at line 53 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

53 { return product_; }

◆ operator*() [1/2]

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

Definition at line 55 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

55 { return *product_; }

◆ operator*() [2/2]

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

Definition at line 56 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

56 { return *product_; }

◆ operator->() [1/2]

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

Definition at line 58 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

58 { return product_; }

◆ operator->() [2/2]

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

Definition at line 59 of file PortableHostObject.h.

References PortableHostObject< T >::product_.

59 { 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 67 of file PortableHostObject.h.

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

67  {
68  // destroy the default-constructed object
69  newObj->~PortableHostObject();
70  // use the global "host" object returned by cms::alpakatools::host()
72  // copy the data from the on-file object to the new one
73  std::memcpy(newObj->product_, &product, sizeof(Product));
74  }
PortableHostObject()=default
alpaka::DevCpu const & host()
Definition: host.h:26
~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

Member Data Documentation

◆ buffer_

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

◆ product_

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