CMS 3D CMS Logo

HcalMahiPulseOffsetsGPU.cc
Go to the documentation of this file.
2 
5 
6 // FIXME: add proper getters to conditions
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 }
12 
14  // deallocation
15  cudaCheck(cudaFree(values));
16 }
17 
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 }
34 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HcalMahiPulseOffsetsGPU(edm::ParameterSet const &)
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
cms::cuda::ESProduct< Product > product_
Product const & getProduct(cudaStream_t) const
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
std::vector< int, cms::cuda::HostAllocator< int > > values_