CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
HcalMahiPulseOffsetsGPU Class Reference

#include <HcalMahiPulseOffsetsGPU.h>

Classes

struct  Product
 

Public Member Functions

Product const & getProduct (cudaStream_t) const
 
std::vector< int, cms::cuda::HostAllocator< int > > const & getValues () const
 
 HcalMahiPulseOffsetsGPU (std::vector< int > const &values)
 
 ~HcalMahiPulseOffsetsGPU ()=default
 

Private Attributes

cms::cuda::ESProduct< Productproduct_
 
std::vector< int, cms::cuda::HostAllocator< int > > values_
 

Detailed Description

Definition at line 9 of file HcalMahiPulseOffsetsGPU.h.

Constructor & Destructor Documentation

◆ HcalMahiPulseOffsetsGPU()

HcalMahiPulseOffsetsGPU::HcalMahiPulseOffsetsGPU ( std::vector< int > const &  values)

Definition at line 7 of file HcalMahiPulseOffsetsGPU.cc.

References filterCSVwithJSON::copy, contentValuesCheck::values, and values_.

7  {
8  values_.resize(values.size());
9  std::copy(values.begin(), values.end(), values_.begin());
10 }
std::vector< int, cms::cuda::HostAllocator< int > > values_

◆ ~HcalMahiPulseOffsetsGPU()

HcalMahiPulseOffsetsGPU::~HcalMahiPulseOffsetsGPU ( )
default

Member Function Documentation

◆ getProduct()

HcalMahiPulseOffsetsGPU::Product const & HcalMahiPulseOffsetsGPU::getProduct ( cudaStream_t  cudaStream) const

Definition at line 17 of file HcalMahiPulseOffsetsGPU.cc.

References cudaCheck, createfilelist::int, product_, HcalMahiPulseOffsetsGPU::Product::values, and values_.

17  {
18  auto const& product = product_.dataForCurrentDeviceAsync(
19  cudaStream, [this](HcalMahiPulseOffsetsGPU::Product& product, cudaStream_t cudaStream) {
20  // malloc
21  cudaCheck(cudaMalloc((void**)&product.values, this->values_.size() * sizeof(int)));
22 
23  // transfer
24  cudaCheck(cudaMemcpyAsync(product.values,
25  this->values_.data(),
26  this->values_.size() * sizeof(int),
27  cudaMemcpyHostToDevice,
28  cudaStream));
29  });
30 
31  return product;
32 }
cms::cuda::ESProduct< Product > product_
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
std::vector< int, cms::cuda::HostAllocator< int > > values_

◆ getValues()

std::vector<int, cms::cuda::HostAllocator<int> > const& HcalMahiPulseOffsetsGPU::getValues ( ) const
inline

Definition at line 23 of file HcalMahiPulseOffsetsGPU.h.

References values_.

23 { return values_; }
std::vector< int, cms::cuda::HostAllocator< int > > values_

Member Data Documentation

◆ product_

cms::cuda::ESProduct<Product> HcalMahiPulseOffsetsGPU::product_
private

Definition at line 31 of file HcalMahiPulseOffsetsGPU.h.

Referenced by getProduct().

◆ values_

std::vector<int, cms::cuda::HostAllocator<int> > HcalMahiPulseOffsetsGPU::values_
private

Definition at line 29 of file HcalMahiPulseOffsetsGPU.h.

Referenced by getProduct(), getValues(), and HcalMahiPulseOffsetsGPU().