CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
PixelTrackSoAFromCUDAT< TrackerTraits > Class Template Reference
Inheritance diagram for PixelTrackSoAFromCUDAT< TrackerTraits >:
edm::stream::EDProducer< edm::ExternalWork >

Public Member Functions

 PixelTrackSoAFromCUDAT (const edm::ParameterSet &iConfig)
 
 ~PixelTrackSoAFromCUDAT () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::ExternalWork >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

using TrackSoADevice = TrackSoAHeterogeneousDevice< TrackerTraits >
 
using TrackSoAHost = TrackSoAHeterogeneousHost< TrackerTraits >
 

Private Member Functions

void acquire (edm::Event const &iEvent, edm::EventSetup const &iSetup, edm::WaitingTaskWithArenaHolder waitingTaskHolder) override
 
void produce (edm::Event &iEvent, edm::EventSetup const &iSetup) override
 

Private Attributes

edm::EDGetTokenT< cms::cuda::Product< TrackSoADevice > > tokenCUDA_
 
edm::EDPutTokenT< TrackSoAHosttokenSOA_
 
TrackSoAHost tracks_h_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::ExternalWork >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<typename TrackerTraits>
class PixelTrackSoAFromCUDAT< TrackerTraits >

Definition at line 26 of file PixelTrackSoAFromCUDA.cc.

Member Typedef Documentation

◆ TrackSoADevice

template<typename TrackerTraits >
using PixelTrackSoAFromCUDAT< TrackerTraits >::TrackSoADevice = TrackSoAHeterogeneousDevice<TrackerTraits>
private

Definition at line 28 of file PixelTrackSoAFromCUDA.cc.

◆ TrackSoAHost

template<typename TrackerTraits >
using PixelTrackSoAFromCUDAT< TrackerTraits >::TrackSoAHost = TrackSoAHeterogeneousHost<TrackerTraits>
private

Definition at line 27 of file PixelTrackSoAFromCUDA.cc.

Constructor & Destructor Documentation

◆ PixelTrackSoAFromCUDAT()

template<typename TrackerTraits >
PixelTrackSoAFromCUDAT< TrackerTraits >::PixelTrackSoAFromCUDAT ( const edm::ParameterSet iConfig)
explicit

Definition at line 49 of file PixelTrackSoAFromCUDA.cc.

50  : tokenCUDA_(consumes(iConfig.getParameter<edm::InputTag>("src"))), tokenSOA_(produces<TrackSoAHost>()) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< cms::cuda::Product< TrackSoADevice > > tokenCUDA_
edm::EDPutTokenT< TrackSoAHost > tokenSOA_

◆ ~PixelTrackSoAFromCUDAT()

template<typename TrackerTraits >
PixelTrackSoAFromCUDAT< TrackerTraits >::~PixelTrackSoAFromCUDAT ( )
overridedefault

Member Function Documentation

◆ acquire()

template<typename TrackerTraits >
void PixelTrackSoAFromCUDAT< TrackerTraits >::acquire ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup,
edm::WaitingTaskWithArenaHolder  waitingTaskHolder 
)
overrideprivate

Definition at line 61 of file PixelTrackSoAFromCUDA.cc.

References cudaCheck, iEvent, and eostools::move().

63  {
64  cms::cuda::Product<TrackSoADevice> const& inputDataWrapped = iEvent.get(tokenCUDA_);
65  cms::cuda::ScopedContextAcquire ctx{inputDataWrapped, std::move(waitingTaskHolder)};
66  auto const& tracks_d = ctx.get(inputDataWrapped); // Tracks on device
67  tracks_h_ = TrackSoAHost(ctx.stream()); // Create an instance of Tracks on Host, using the stream
68  cudaCheck(cudaMemcpyAsync(tracks_h_.buffer().get(),
69  tracks_d.const_buffer().get(),
70  tracks_d.bufferSize(),
71  cudaMemcpyDeviceToHost,
72  ctx.stream())); // Copy data from Device to Host
73 }
edm::EDGetTokenT< cms::cuda::Product< TrackSoADevice > > tokenCUDA_
int iEvent
Definition: GenABIO.cc:224
TrackSoAHeterogeneousHost< TrackerTraits > TrackSoAHost
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

template<typename TrackerTraits >
void PixelTrackSoAFromCUDAT< TrackerTraits >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

◆ produce()

template<typename TrackerTraits >
void PixelTrackSoAFromCUDAT< TrackerTraits >::produce ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 76 of file PixelTrackSoAFromCUDA.cc.

References cms::cuda::assert(), gather_cfg::cout, iEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, DMR_cfg::maxTracks, eostools::move(), nHits, TracksUtilities< TrackerTraits >::nHits(), nt, and beamSpotPI::nTracks.

76  {
77  auto maxTracks = tracks_h_.view().metadata().size();
78  auto nTracks = tracks_h_.view().nTracks();
79 
81  if (nTracks == maxTracks - 1) {
82  edm::LogWarning("PixelTracks") << "Unsorted reconstructed pixel tracks truncated to " << maxTracks - 1
83  << " candidates";
84  }
85 
86 #ifdef PIXEL_DEBUG_PRODUCE
87  std::cout << "size of SoA " << sizeof(tsoa) << " stride " << maxTracks << std::endl;
88  std::cout << "found " << nTracks << " tracks in cpu SoA at " << &tsoa << std::endl;
89 
90  int32_t nt = 0;
91  for (int32_t it = 0; it < maxTracks; ++it) {
93  assert(nHits == int(tracks_h_.view().hitIndices().size(it)));
94  if (nHits == 0)
95  break; // this is a guard: maybe we need to move to nTracks...
96  nt++;
97  }
98  assert(nTracks == nt);
99 #endif
100 
101  // DO NOT make a copy (actually TWO....)
102  iEvent.emplace(tokenSOA_, std::move(tracks_h_));
103  assert(!tracks_h_.buffer());
104 }
edm::EDPutTokenT< TrackSoAHost > tokenSOA_
assert(be >=bs)
int iEvent
Definition: GenABIO.cc:224
int nt
Definition: AMPTWrapper.h:42
static constexpr __host__ __device__ int nHits(const TrackSoAConstView &tracks, int i)
maxTracks
Definition: DMR_cfg.py:158
Log< level::Warning, false > LogWarning
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ tokenCUDA_

template<typename TrackerTraits >
edm::EDGetTokenT<cms::cuda::Product<TrackSoADevice> > PixelTrackSoAFromCUDAT< TrackerTraits >::tokenCUDA_
private

Definition at line 42 of file PixelTrackSoAFromCUDA.cc.

◆ tokenSOA_

template<typename TrackerTraits >
edm::EDPutTokenT<TrackSoAHost> PixelTrackSoAFromCUDAT< TrackerTraits >::tokenSOA_
private

Definition at line 43 of file PixelTrackSoAFromCUDA.cc.

◆ tracks_h_

template<typename TrackerTraits >
TrackSoAHost PixelTrackSoAFromCUDAT< TrackerTraits >::tracks_h_
private

Definition at line 45 of file PixelTrackSoAFromCUDA.cc.