CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::EarlyDeleteHelper Class Reference

#include <EarlyDeleteHelper.h>

Public Member Functions

void addedToPath ()
 
void appendIndex (unsigned int index)
 
unsigned int * begin ()
 
 EarlyDeleteHelper (const EarlyDeleteHelper &)
 
 EarlyDeleteHelper (unsigned int *iBeginIndexItr, unsigned int *iEndIndexItr, std::vector< BranchToCount > *iBranchCounts)
 
unsigned int * end ()
 
void moduleRan (EventPrincipal const &)
 
EarlyDeleteHelperoperator= (const EarlyDeleteHelper &)=delete
 
void pathFinished (EventPrincipal const &)
 
void reset ()
 
void shiftIndexPointers (unsigned int iShift)
 

Private Attributes

unsigned int nPathsOn_
 
std::atomic< unsigned int > pathsLeftToComplete_
 
unsigned int * pBeginIndex_
 
std::vector< BranchToCount > * pBranchCounts_
 
unsigned int * pEndIndex_
 

Detailed Description

Definition at line 40 of file EarlyDeleteHelper.h.

Constructor & Destructor Documentation

◆ EarlyDeleteHelper() [1/2]

EarlyDeleteHelper::EarlyDeleteHelper ( unsigned int *  iBeginIndexItr,
unsigned int *  iEndIndexItr,
std::vector< BranchToCount > *  iBranchCounts 
)

Definition at line 33 of file EarlyDeleteHelper.cc.

36  : pBeginIndex_(iBeginIndexItr),
37  pEndIndex_(iEndIndexItr),
38  pBranchCounts_(iBranchCounts),
40  nPathsOn_(0) {}

◆ EarlyDeleteHelper() [2/2]

EarlyDeleteHelper::EarlyDeleteHelper ( const EarlyDeleteHelper rhs)

Definition at line 42 of file EarlyDeleteHelper.cc.

Member Function Documentation

◆ addedToPath()

void edm::EarlyDeleteHelper::addedToPath ( )
inline

Definition at line 57 of file EarlyDeleteHelper.h.

57 { ++nPathsOn_; }

References nPathsOn_.

◆ appendIndex()

void EarlyDeleteHelper::appendIndex ( unsigned int  index)

Definition at line 94 of file EarlyDeleteHelper.cc.

94  {
95  *pEndIndex_ = iIndex;
96  ++pEndIndex_;
97 }

References pEndIndex_.

◆ begin()

unsigned int* edm::EarlyDeleteHelper::begin ( void  )
inline

Definition at line 61 of file EarlyDeleteHelper.h.

61 { return pBeginIndex_; }

References pBeginIndex_.

◆ end()

unsigned int* edm::EarlyDeleteHelper::end ( void  )
inline

Definition at line 62 of file EarlyDeleteHelper.h.

62 { return pEndIndex_; }

References pEndIndex_.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

◆ moduleRan()

void EarlyDeleteHelper::moduleRan ( EventPrincipal const &  iEvent)

Definition at line 68 of file EarlyDeleteHelper.cc.

68  {
70  for (auto it = pBeginIndex_; it != pEndIndex_; ++it) {
71  auto& count = (*pBranchCounts_)[*it];
72  assert(count.count > 0);
73  auto value = --(count.count);
74  if (value == 0) {
75  iEvent.deleteProduct(count.branch);
76  }
77  }
78 }

References cms::cuda::assert(), submitPVResolutionJobs::count, iEvent, pathsLeftToComplete_, pBeginIndex_, and pEndIndex_.

Referenced by pathFinished().

◆ operator=()

EarlyDeleteHelper& edm::EarlyDeleteHelper::operator= ( const EarlyDeleteHelper )
delete

◆ pathFinished()

void EarlyDeleteHelper::pathFinished ( EventPrincipal const &  iEvent)

Definition at line 80 of file EarlyDeleteHelper.cc.

80  {
81  unsigned int value = pathsLeftToComplete_;
82  while (value > 0) {
83  if (pathsLeftToComplete_.compare_exchange_strong(value, value - 1)) {
84  //we were the thread that changed the value
85  if (value == 1) {
86  //we can never reach this module now so declare it as run
88  }
89  break;
90  }
91  }
92 }

References iEvent, moduleRan(), and pathsLeftToComplete_.

◆ reset()

void edm::EarlyDeleteHelper::reset ( void  )
inline

Definition at line 54 of file EarlyDeleteHelper.h.

References nPathsOn_, and pathsLeftToComplete_.

◆ shiftIndexPointers()

void EarlyDeleteHelper::shiftIndexPointers ( unsigned int  iShift)

Definition at line 99 of file EarlyDeleteHelper.cc.

99  {
100  pEndIndex_ -= iShift;
101  pBeginIndex_ -= iShift;
102 }

References pBeginIndex_, and pEndIndex_.

Member Data Documentation

◆ nPathsOn_

unsigned int edm::EarlyDeleteHelper::nPathsOn_
private

Definition at line 70 of file EarlyDeleteHelper.h.

Referenced by addedToPath(), and reset().

◆ pathsLeftToComplete_

std::atomic<unsigned int> edm::EarlyDeleteHelper::pathsLeftToComplete_
private

Definition at line 69 of file EarlyDeleteHelper.h.

Referenced by moduleRan(), pathFinished(), and reset().

◆ pBeginIndex_

unsigned int* edm::EarlyDeleteHelper::pBeginIndex_
private

Definition at line 66 of file EarlyDeleteHelper.h.

Referenced by begin(), moduleRan(), and shiftIndexPointers().

◆ pBranchCounts_

std::vector<BranchToCount>* edm::EarlyDeleteHelper::pBranchCounts_
private

Definition at line 68 of file EarlyDeleteHelper.h.

◆ pEndIndex_

unsigned int* edm::EarlyDeleteHelper::pEndIndex_
private

Definition at line 67 of file EarlyDeleteHelper.h.

Referenced by appendIndex(), end(), moduleRan(), and shiftIndexPointers().

edm::EarlyDeleteHelper::moduleRan
void moduleRan(EventPrincipal const &)
Definition: EarlyDeleteHelper.cc:68
edm::EarlyDeleteHelper::pathsLeftToComplete_
std::atomic< unsigned int > pathsLeftToComplete_
Definition: EarlyDeleteHelper.h:69
cms::cuda::assert
assert(be >=bs)
edm::EarlyDeleteHelper::pBranchCounts_
std::vector< BranchToCount > * pBranchCounts_
Definition: EarlyDeleteHelper.h:68
edm::EarlyDeleteHelper::nPathsOn_
unsigned int nPathsOn_
Definition: EarlyDeleteHelper.h:70
edm::EarlyDeleteHelper::pEndIndex_
unsigned int * pEndIndex_
Definition: EarlyDeleteHelper.h:67
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
edm::EarlyDeleteHelper::pBeginIndex_
unsigned int * pBeginIndex_
Definition: EarlyDeleteHelper.h:66