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 (edm::ParameterSet const &)
 
 ~HcalMahiPulseOffsetsGPU ()=default
 

Private Attributes

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

Detailed Description

Definition at line 11 of file HcalMahiPulseOffsetsGPU.h.

Constructor & Destructor Documentation

◆ HcalMahiPulseOffsetsGPU()

HcalMahiPulseOffsetsGPU::HcalMahiPulseOffsetsGPU ( edm::ParameterSet const &  ps)

Definition at line 7 of file HcalMahiPulseOffsetsGPU.cc.

References filterCSVwithJSON::copy, edm::ParameterSet::getParameter(), contentValuesCheck::values, and values_.

7  {
8  auto const& values = ps.getParameter<std::vector<int>>("pulseOffsets");
9  values_.resize(values.size());
10  std::copy(values.begin(), values.end(), values_.begin());
11 }
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 18 of file HcalMahiPulseOffsetsGPU.cc.

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

18  {
19  auto const& product = product_.dataForCurrentDeviceAsync(
20  cudaStream, [this](HcalMahiPulseOffsetsGPU::Product& product, cudaStream_t cudaStream) {
21  // malloc
22  cudaCheck(cudaMalloc((void**)&product.values, this->values_.size() * sizeof(int)));
23 
24  // transfer
25  cudaCheck(cudaMemcpyAsync(product.values,
26  this->values_.data(),
27  this->values_.size() * sizeof(int),
28  cudaMemcpyHostToDevice,
29  cudaStream));
30  });
31 
32  return product;
33 }
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 25 of file HcalMahiPulseOffsetsGPU.h.

References values_.

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

Member Data Documentation

◆ product_

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

Definition at line 33 of file HcalMahiPulseOffsetsGPU.h.

Referenced by getProduct().

◆ values_

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

Definition at line 31 of file HcalMahiPulseOffsetsGPU.h.

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