CMS 3D CMS Logo

SiPixelDigiErrorsSoAFromCUDA.cc
Go to the documentation of this file.
13 
14 class SiPixelDigiErrorsSoAFromCUDA : public edm::stream::EDProducer<edm::ExternalWork> {
15 public:
16  explicit SiPixelDigiErrorsSoAFromCUDA(const edm::ParameterSet& iConfig);
17  ~SiPixelDigiErrorsSoAFromCUDA() override = default;
18 
19  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
20 
21 private:
22  void acquire(const edm::Event& iEvent,
23  const edm::EventSetup& iSetup,
24  edm::WaitingTaskWithArenaHolder waitingTaskHolder) override;
25  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
26 
29 
33 };
34 
36  : digiErrorGetToken_(
37  consumes<cms::cuda::Product<SiPixelDigiErrorsCUDA>>(iConfig.getParameter<edm::InputTag>("src"))),
38  digiErrorPutToken_(produces<SiPixelErrorsSoA>()) {}
39 
42  desc.add<edm::InputTag>("src", edm::InputTag("siPixelClustersCUDA"));
43  descriptions.addWithDefaultLabel(desc);
44 }
45 
47  const edm::EventSetup& iSetup,
48  edm::WaitingTaskWithArenaHolder waitingTaskHolder) {
49  // Do the transfer in a CUDA stream parallel to the computation CUDA stream
50  cms::cuda::ScopedContextAcquire ctx{iEvent.streamID(), std::move(waitingTaskHolder)};
51 
52  const auto& gpuDigiErrors = ctx.get(iEvent, digiErrorGetToken_);
53 
54  auto tmp = gpuDigiErrors.dataErrorToHostAsync(ctx.stream());
55  error_ = tmp.first;
56  data_ = std::move(tmp.second);
57  formatterErrors_ = &(gpuDigiErrors.formatterErrors());
58 }
59 
61  // The following line copies the data from the pinned host memory to
62  // regular host memory. In principle that feels unnecessary (why not
63  // just use the pinned host memory?). There are a few arguments for
64  // doing it though
65  // - Now can release the pinned host memory back to the (caching) allocator
66  // * if we'd like to keep the pinned memory, we'd need to also
67  // keep the CUDA stream around as long as that, or allow pinned
68  // host memory to be allocated without a CUDA stream
69  // - What if a CPU algorithm would produce the same SoA? We can't
70  // use cudaMallocHost without a GPU...
72 
73  error_ = cms::cuda::make_SimpleVector<SiPixelErrorCompact>(0, nullptr);
74  data_.reset();
75  formatterErrors_ = nullptr;
76 }
77 
78 // define as framework plugin
ConfigurationDescriptions.h
SiPixelDigiErrorsSoAFromCUDA::data_
cms::cuda::host::unique_ptr< SiPixelErrorCompact[]> data_
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:30
SiPixelDigiErrorsSoAFromCUDA::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:40
SiPixelDigiErrorsSoAFromCUDA::digiErrorGetToken_
edm::EDGetTokenT< cms::cuda::Product< SiPixelDigiErrorsCUDA > > digiErrorGetToken_
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:27
cms::cuda::SimpleVector::data
constexpr const T * data() const
Definition: SimpleVector.h:111
SiPixelDigiErrorsSoAFromCUDA::SiPixelDigiErrorsSoAFromCUDA
SiPixelDigiErrorsSoAFromCUDA(const edm::ParameterSet &iConfig)
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:35
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
SiPixelDigiErrorsSoAFromCUDA::~SiPixelDigiErrorsSoAFromCUDA
~SiPixelDigiErrorsSoAFromCUDA() override=default
edm::EDPutTokenT< SiPixelErrorsSoA >
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SiPixelDigiErrorsSoAFromCUDA::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:60
EDProducer.h
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
cms::cuda::SimpleVector< SiPixelErrorCompact >
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:34
MakerMacros.h
SiPixelDigiErrorsSoAFromCUDA
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:14
SiPixelDigiErrorsSoAFromCUDA::acquire
void acquire(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::WaitingTaskWithArenaHolder waitingTaskHolder) override
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:46
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
host_unique_ptr.h
SiPixelDigiErrorsCUDA
Definition: SiPixelDigiErrorsCUDA.h:12
ParameterSetDescription.h
SiPixelDigiErrorsSoAFromCUDA::error_
cms::cuda::SimpleVector< SiPixelErrorCompact > error_
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:31
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
SiPixelDigiErrorsSoAFromCUDA::digiErrorPutToken_
edm::EDPutTokenT< SiPixelErrorsSoA > digiErrorPutToken_
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:28
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:36
SiPixelDigiErrorsCUDA.h
edm::EventSetup
Definition: EventSetup.h:58
SiPixelErrorsSoA
Definition: SiPixelErrorsSoA.h:10
cms::cuda::ScopedContextAcquire
Definition: ScopedContext.h:101
Product.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiPixelErrorsSoA.h
cms::cuda::host::unique_ptr
std::unique_ptr< T, impl::HostDeleter > unique_ptr
Definition: host_unique_ptr.h:21
ScopedContext.h
ecalDigis_cff.cuda
cuda
Definition: ecalDigis_cff.py:35
EventSetup.h
SiPixelFormatterErrors
std::map< cms_uint32_t, std::vector< SiPixelRawDataError > > SiPixelFormatterErrors
Definition: SiPixelFormatterErrors.h:10
ParameterSet.h
edm::Event
Definition: Event.h:73
cms::cuda::SimpleVector::size
constexpr int size() const
Definition: SimpleVector.h:109
SiPixelDigiErrorsSoAFromCUDA::formatterErrors_
const SiPixelFormatterErrors * formatterErrors_
Definition: SiPixelDigiErrorsSoAFromCUDA.cc:32
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21