CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
hcal::raw::ElectronicsMappingGPU Class Reference

#include <ElectronicsMappingGPU.h>

Classes

struct  Product
 

Public Member Functions

 ElectronicsMappingGPU (HcalElectronicsMap const &)
 
const ProductgetProduct (cudaStream_t) const
 
 ~ElectronicsMappingGPU ()=default
 

Private Attributes

std::vector< uint32_t, cms::cuda::HostAllocator< uint32_t > > eid2did_
 
std::vector< uint32_t, cms::cuda::HostAllocator< uint32_t > > eid2tid_
 
cms::cuda::ESProduct< Productproduct_
 

Detailed Description

Definition at line 14 of file ElectronicsMappingGPU.h.

Constructor & Destructor Documentation

◆ ElectronicsMappingGPU()

hcal::raw::ElectronicsMappingGPU::ElectronicsMappingGPU ( HcalElectronicsMap const &  mapping)

Definition at line 12 of file ElectronicsMappingGPU.cc.

14  auto const& eidsPrecision = mapping.allElectronicsIdPrecision();
15  for (uint32_t i = 0; i < eidsPrecision.size(); ++i) {
16  auto const& eid = eidsPrecision[i];
17 
18  // assign
19  eid2did_[eid.linearIndex()] = eid.isTriggerChainId() ? 0u : mapping.lookup(eid).rawId();
20  }
21 
22  auto const& eidsTrigger = mapping.allElectronicsIdTrigger();
23  for (uint32_t i = 0; i < eidsTrigger.size(); i++) {
24  auto const& eid = eidsTrigger[i];
25 
26  // assign
27  eid2tid_[eid.linearIndex()] = eid.isTriggerChainId() ? mapping.lookupTrigger(eid).rawId() : 0u;
28  }
29  }

References runTauDisplay::eid, eid2did_, eid2tid_, mps_fire::i, and taus_updatedMVAIds_cff::mapping.

◆ ~ElectronicsMappingGPU()

hcal::raw::ElectronicsMappingGPU::~ElectronicsMappingGPU ( )
default

Member Function Documentation

◆ getProduct()

ElectronicsMappingGPU::Product const & hcal::raw::ElectronicsMappingGPU::getProduct ( cudaStream_t  cudaStream) const

Definition at line 37 of file ElectronicsMappingGPU.cc.

37  {
38  auto const& product = product_.dataForCurrentDeviceAsync(
39  cudaStream, [this](ElectronicsMappingGPU::Product& product, cudaStream_t cudaStream) {
40  // malloc
41  cudaCheck(cudaMalloc((void**)&product.eid2did, this->eid2did_.size() * sizeof(uint32_t)));
42  cudaCheck(cudaMalloc((void**)&product.eid2tid, this->eid2tid_.size() * sizeof(uint32_t)));
43 
44  // transfer
45  cudaCheck(cudaMemcpyAsync(product.eid2did,
46  this->eid2did_.data(),
47  this->eid2did_.size() * sizeof(uint32_t),
48  cudaMemcpyHostToDevice,
49  cudaStream));
50  cudaCheck(cudaMemcpyAsync(product.eid2tid,
51  this->eid2tid_.data(),
52  this->eid2tid_.size() * sizeof(uint32_t),
53  cudaMemcpyHostToDevice,
54  cudaStream));
55  });
56 
57  return product;
58  }

References cudaCheck, hcal::raw::ElectronicsMappingGPU::Product::eid2did, eid2did_, hcal::raw::ElectronicsMappingGPU::Product::eid2tid, eid2tid_, and product_.

Referenced by HcalRawToDigiGPU::acquire().

Member Data Documentation

◆ eid2did_

std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t> > hcal::raw::ElectronicsMappingGPU::eid2did_
private

Definition at line 39 of file ElectronicsMappingGPU.h.

Referenced by ElectronicsMappingGPU(), and getProduct().

◆ eid2tid_

std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t> > hcal::raw::ElectronicsMappingGPU::eid2tid_
private

Definition at line 38 of file ElectronicsMappingGPU.h.

Referenced by ElectronicsMappingGPU(), and getProduct().

◆ product_

cms::cuda::ESProduct<Product> hcal::raw::ElectronicsMappingGPU::product_
private

Definition at line 41 of file ElectronicsMappingGPU.h.

Referenced by getProduct().

mps_fire.i
i
Definition: mps_fire.py:428
hcal::raw::ElectronicsMappingGPU::eid2did_
std::vector< uint32_t, cms::cuda::HostAllocator< uint32_t > > eid2did_
Definition: ElectronicsMappingGPU.h:39
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
HcalElectronicsId::maxLinearIndex
static const int maxLinearIndex
Definition: HcalElectronicsId.h:115
hcal::raw::ElectronicsMappingGPU::eid2tid_
std::vector< uint32_t, cms::cuda::HostAllocator< uint32_t > > eid2tid_
Definition: ElectronicsMappingGPU.h:38
cudaCheck
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:62
taus_updatedMVAIds_cff.mapping
mapping
Definition: taus_updatedMVAIds_cff.py:29
hcal::raw::ElectronicsMappingGPU::product_
cms::cuda::ESProduct< Product > product_
Definition: ElectronicsMappingGPU.h:41