CMS 3D CMS Logo

HcalSiPMCharacteristicsGPU.cc
Go to the documentation of this file.
6 
8  : pixels_(parameters.getTypes()),
9  auxi1_(parameters.getTypes()),
10  parLin1_(parameters.getTypes()),
11  parLin2_(parameters.getTypes()),
12  parLin3_(parameters.getTypes()),
13  crossTalk_(parameters.getTypes()),
14  auxi2_(parameters.getTypes()) {
15  for (uint32_t i = 0; i < parameters.getTypes(); i++) {
16  auto const type = parameters.getType(i);
17 #ifdef HCAL_MAHI_CPUDEBUG
18  printf("index = %u type = %d\n", i, type);
19 #endif
20 
21  // for now...
22  if (static_cast<uint32_t>(type) != i + 1)
23  throw cms::Exception("HcalSiPMCharacteristics")
24  << "Wrong assumption for HcalSiPMcharacteristics type values, "
25  << "should be type value <- type index + 1" << std::endl
26  << "Observed type value = " << type << " and index = " << i << std::endl;
27 
28  pixels_[i] = parameters.getPixels(type);
29  auxi1_[i] = parameters.getAuxi1(type);
30  parLin1_[i] = parameters.getNonLinearities(type)[0];
31  parLin2_[i] = parameters.getNonLinearities(type)[1];
32  parLin3_[i] = parameters.getNonLinearities(type)[2];
33  crossTalk_[i] = parameters.getCrossTalk(type);
34  auxi2_[i] = parameters.getAuxi2(type);
35  }
36 }
37 
39  auto const& product = product_.dataForCurrentDeviceAsync(
40  stream, [this](HcalSiPMCharacteristicsGPU::Product& product, cudaStream_t stream) {
41  // allocate
42  product.pixels = cms::cuda::make_device_unique<int[]>(pixels_.size(), stream);
43  product.auxi1 = cms::cuda::make_device_unique<int[]>(auxi1_.size(), stream);
44  product.parLin1 = cms::cuda::make_device_unique<float[]>(parLin1_.size(), stream);
45  product.parLin2 = cms::cuda::make_device_unique<float[]>(parLin2_.size(), stream);
46  product.parLin3 = cms::cuda::make_device_unique<float[]>(parLin3_.size(), stream);
47  product.crossTalk = cms::cuda::make_device_unique<float[]>(crossTalk_.size(), stream);
48  product.auxi2 = cms::cuda::make_device_unique<float[]>(auxi2_.size(), stream);
49 
50  // transfer
58  });
59 
60  return product;
61 }
62 
std::vector< float, cms::cuda::HostAllocator< float > > auxi2_
std::vector< int, cms::cuda::HostAllocator< int > > pixels_
HcalSiPMCharacteristicsGPU(HcalSiPMCharacteristics const &)
edm::propagate_const_array< cms::cuda::device::unique_ptr< int[]> > auxi1
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > parLin1
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[]> > parLin3
cms::cuda::ESProduct< Product > product_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > auxi2
Product const & getProduct(cudaStream_t) const
edm::propagate_const_array< cms::cuda::device::unique_ptr< int[]> > pixels
std::vector< int, cms::cuda::HostAllocator< int > > auxi1_
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
std::vector< float, cms::cuda::HostAllocator< float > > parLin1_
std::vector< float, cms::cuda::HostAllocator< float > > parLin3_
std::vector< float, cms::cuda::HostAllocator< float > > parLin2_
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > parLin2
std::vector< float, cms::cuda::HostAllocator< float > > crossTalk_
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > crossTalk