CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalSiPMParametersGPU.cc
Go to the documentation of this file.
5 
7  : totalChannels_{parameters.getAllContainers()[0].second.size() + parameters.getAllContainers()[1].second.size()},
8  type_(totalChannels_),
9  auxi1_(totalChannels_),
10  fcByPE_(totalChannels_),
11  darkCurrent_(totalChannels_),
12  auxi2_(totalChannels_) {
13  auto const containers = parameters.getAllContainers();
14 
15  // fill in eb
16  auto const& barrelValues = containers[0].second;
17  for (uint64_t i = 0; i < barrelValues.size(); ++i) {
18  auto const& item = barrelValues[i];
19  type_[i] = item.getType();
20  auxi1_[i] = item.getauxi1();
21  fcByPE_[i] = item.getFCByPE();
22  darkCurrent_[i] = item.getDarkCurrent();
23  auxi2_[i] = item.getauxi2();
24  }
25 
26  // fill in ee
27  auto const& endcapValues = containers[1].second;
28  auto const offset = barrelValues.size();
29  for (uint64_t i = 0; i < endcapValues.size(); ++i) {
30  auto const off = offset + i;
31  auto const& item = endcapValues[i];
32  type_[off] = item.getType();
33  auxi1_[off] = item.getauxi1();
34  fcByPE_[off] = item.getFCByPE();
35  darkCurrent_[off] = item.getDarkCurrent();
36  auxi2_[off] = item.getauxi2();
37  }
38 }
39 
41  auto const& product =
42  product_.dataForCurrentDeviceAsync(stream, [this](HcalSiPMParametersGPU::Product& product, cudaStream_t stream) {
43  // allocate
44  product.type = cms::cuda::make_device_unique<int[]>(type_.size(), stream);
45  product.auxi1 = cms::cuda::make_device_unique<int[]>(auxi1_.size(), stream);
46  product.fcByPE = cms::cuda::make_device_unique<float[]>(fcByPE_.size(), stream);
47  product.darkCurrent = cms::cuda::make_device_unique<float[]>(darkCurrent_.size(), stream);
48  product.auxi2 = cms::cuda::make_device_unique<float[]>(auxi2_.size(), stream);
49 
50  // transfer
51  cms::cuda::copyAsync(product.type, type_, stream);
52  cms::cuda::copyAsync(product.auxi1, auxi1_, stream);
53  cms::cuda::copyAsync(product.fcByPE, fcByPE_, stream);
55  cms::cuda::copyAsync(product.auxi2, auxi2_, stream);
56  });
57 
58  return product;
59 }
60 
HcalSiPMParametersGPU(HcalSiPMParameters const &)
cms::cuda::ESProduct< Product > product_
Product const & getProduct(cudaStream_t) const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > auxi2
std::vector< int, cms::cuda::HostAllocator< int > > type_
const tAllContWithNames getAllContainers() const
std::vector< float, cms::cuda::HostAllocator< float > > auxi2_
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
edm::propagate_const_array< cms::cuda::device::unique_ptr< int[]> > type
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > darkCurrent
unsigned long long uint64_t
Definition: Time.h:13
edm::propagate_const_array< cms::cuda::device::unique_ptr< int[]> > auxi1
std::vector< int, cms::cuda::HostAllocator< int > > auxi1_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > fcByPE
std::vector< float, cms::cuda::HostAllocator< float > > darkCurrent_
std::vector< float, cms::cuda::HostAllocator< float > > fcByPE_