CMS 3D CMS Logo

Namespaces | Functions | Variables
gpuClustering Namespace Reference

Namespaces

 pixelStatus
 

Functions

template<bool isPhase2>
 __attribute__ ((always_inline)) void clusterChargeCut(SiPixelClusterThresholds clusterThresholds
 
 assert (nMaxModules< maxNumModules)
 
 for (auto module=firstModule;module< endModule;module+=gridDim.x)
 
constexpr uint32_t maxHitsInIter ()
 
constexpr uint32_t maxHitsInModule ()
 

Variables

uint16_t *__restrict__ uint16_t const *__restrict__ adc
 
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ clusterId
 
auto endModule = moduleStart[0]
 
auto firstModule = blockIdx.x
 
uint16_t *__restrict__ id
 
constexpr int invalidClusterId = -9999
 
constexpr uint16_t invalidModuleId = std::numeric_limits<uint16_t>::max() - 1
 
constexpr int32_t maxNumClustersPerModules = maxHitsInModule()
 
constexpr uint32_t maxNumDigis = 3 * 256 * 1024
 
constexpr uint16_t maxNumModules = 4000
 
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ moduleId
 
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ moduleStart
 
__shared__ int msize
 
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ nClustersInModule
 
__shared__ uint16_t newclusId [maxNumClustersPerModules]
 
constexpr int nMaxModules
 
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ uint32_t numElements
 
__shared__ uint8_t ok [maxNumClustersPerModules]
 
constexpr uint32_t pixelSizeX = 160
 
constexpr uint32_t pixelSizeY = 416
 
constexpr int startBPIX2 = isPhase2 ? phase2PixelTopology::layerStart[1] : phase1PixelTopology::layerStart[1]
 
__shared__ uint32_t status [pixelStatusSize]
 
uint16_t *__restrict__ uint16_t const *__restrict__ x
 
uint16_t *__restrict__ uint16_t const *__restrict__ uint16_t const *__restrict__ y
 

Function Documentation

◆ __attribute__()

template<bool isPhase2>
gpuClustering::__attribute__ ( (always_inline)  )
inline

◆ assert()

gpuClustering::assert ( )

Referenced by for().

◆ for()

gpuClustering::for ( )

Definition at line 41 of file gpuClusterChargeCut.h.

References cms::cudacompat::__syncthreads(), cms::cudacompat::__syncthreads_and(), adc, assert(), cms::cudacompat::atomicAdd(), cms::cudacompat::blockDim, cms::cudacompat::blockIdx, ALCARECOTkAlJpsiMuMu_cff::charge, clusterId, first, SiPixelClusterThresholds::getThresholdForLayerOnCondition(), good, mps_fire::i, invalidModuleId, maxNumClustersPerModules, callgraph::module, moduleId, moduleStart, nClustersInModule, newclusId, nMaxModules, numElements, ok, startBPIX2, cms::cudacompat::threadIdx, and gpuVertexFinder::ws.

41  {
42  auto firstPixel = moduleStart[1 + module];
43  auto thisModuleId = id[firstPixel];
44  while (thisModuleId == invalidModuleId and firstPixel < numElements) {
45  // skip invalid or duplicate pixels
46  ++firstPixel;
47  thisModuleId = id[firstPixel];
48  }
49  if (firstPixel >= numElements) {
50  // reached the end of the input while skipping the invalid pixels, nothing left to do
51  break;
52  }
53  if (thisModuleId != moduleId[module]) {
54  // reached the end of the module while skipping the invalid pixels, skip this module
55  continue;
56  }
57  assert(thisModuleId < nMaxModules);
58 
59  auto nclus = nClustersInModule[thisModuleId];
60  if (nclus == 0)
61  continue;
62 
63  if (threadIdx.x == 0 && nclus > maxNumClustersPerModules)
64  printf("Warning too many clusters in module %d in block %d: %d > %d\n",
65  thisModuleId,
66  blockIdx.x,
67  nclus,
69 
70  auto first = firstPixel + threadIdx.x;
71 
72  if (nclus > maxNumClustersPerModules) {
73  // remove excess FIXME find a way to cut charge first....
74  for (auto i = first; i < numElements; i += blockDim.x) {
75  if (id[i] == invalidModuleId)
76  continue; // not valid
77  if (id[i] != thisModuleId)
78  break; // end of module
80  id[i] = invalidModuleId;
82  }
83  }
85  }
86 
87 #ifdef GPU_DEBUG
88  if (thisModuleId % 100 == 1)
89  if (threadIdx.x == 0)
90  printf("start cluster charge cut for module %d in block %d\n", thisModuleId, blockIdx.x);
91 #endif
92 
94  for (auto i = threadIdx.x; i < nclus; i += blockDim.x) {
95  charge[i] = 0;
96  }
97  __syncthreads();
98 
99  for (auto i = first; i < numElements; i += blockDim.x) {
100  if (id[i] == invalidModuleId)
101  continue; // not valid
102  if (id[i] != thisModuleId)
103  break; // end of module
105  }
106  __syncthreads();
107 
108  auto chargeCut = clusterThresholds.getThresholdForLayerOnCondition(thisModuleId < startBPIX2);
109 
110  bool good = true;
111  for (auto i = threadIdx.x; i < nclus; i += blockDim.x) {
112  newclusId[i] = ok[i] = charge[i] >= chargeCut ? 1 : 0;
113  if (0 == ok[i])
114  good = false;
115  }
116 
117  // if all clusters above threshold do nothing
118  if (__syncthreads_and(good))
119  continue;
120 
121  // renumber
122  __shared__ uint16_t ws[32];
123  cms::cuda::blockPrefixScan(newclusId, nclus, ws);
124 
125  assert(nclus > newclusId[nclus - 1]);
126 
127  nClustersInModule[thisModuleId] = newclusId[nclus - 1];
128 
129  // reassign id
130  for (auto i = first; i < numElements; i += blockDim.x) {
131  if (id[i] == invalidModuleId)
132  continue; // not valid
133  if (id[i] != thisModuleId)
134  break; // end of module
135  if (0 == ok[clusterId[i]])
136  clusterId[i] = id[i] = invalidModuleId;
137  else
138  clusterId[i] = newclusId[clusterId[i]] - 1;
139  }
140 
141  //done
142  __syncthreads();
143  } // loop on modules
const dim3 threadIdx
Definition: cudaCompat.h:29
__shared__ uint8_t ok[maxNumClustersPerModules]
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ nClustersInModule
constexpr int nMaxModules
const dim3 blockDim
Definition: cudaCompat.h:30
auto &__restrict__ ws
assert(nMaxModules< maxNumModules)
constexpr int startBPIX2
constexpr int32_t maxNumClustersPerModules
const dim3 blockIdx
Definition: cudaCompat.h:32
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ clusterId
constexpr uint16_t invalidModuleId
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ uint32_t numElements
auto const good
min quality of good
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ moduleStart
__shared__ uint16_t newclusId[maxNumClustersPerModules]
void __syncthreads()
Definition: cudaCompat.h:132
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ moduleId
bool __syncthreads_and(bool x)
Definition: cudaCompat.h:135
T1 atomicAdd(T1 *a, T2 b)
Definition: cudaCompat.h:61
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ maxHitsInIter()

constexpr uint32_t gpuClustering::maxHitsInIter ( )

Definition at line 14 of file gpuClusteringConstants.h.

14 { return 160; } //TODO better tuning for PU 140-200

◆ maxHitsInModule()

constexpr uint32_t gpuClustering::maxHitsInModule ( )

Definition at line 16 of file gpuClusteringConstants.h.

Referenced by SiPixelRecHitFromCUDA::produce(), and SiPixelRecHitSoAFromLegacy::produce().

16 { return 1024; }

Variable Documentation

◆ adc

uint16_t* __restrict__ uint16_t const* __restrict__ gpuClustering::adc

Definition at line 21 of file gpuClusterChargeCut.h.

Referenced by QIE10Task::_process(), QIE11Task::_process(), PedestalTask::_process(), LEDTask::_process(), DigiTask::_process(), LaserTask::_process(), CastorCoderDb::adc2fC_(), HcalCoderDb::adc2fC_(), CastorTPGCoder::adc2Linear(), HcalTPGCoder::adc2Linear(), HcaluLUTTPGCoder::adc2Linear(), hcal::adc_for_sample(), SiPixelCluster::add(), SiPixelArrayBuffer::add_adc(), ThreeThresholdAlgorithm::addToCandidate(), ESElectronicsSimFast::analogToDigital(), CSCComparatorDigiValidation::analyze(), ZDCQIE10Task::analyze(), ESTimingTask::analyze(), FCDTask::analyze(), SiStripBaselineValidator::analyze(), ZDCTask::analyze(), EcalPreshowerNoiseDistrib::analyze(), CastorDigiStatistics::analyze(), SiStripMonitorDigi::analyze(), HcalDigiStatistics::analyze(), CTPPSPixelDQMSource::analyze(), BtlDigiHitsValidation::analyze(), HGCalDigiValidation::analyze(), EcalSimRawData::analyze(), EcalLaserAnalyzerYousi::analyze(), HGCalTBAnalyzer::analyze(), RecAnalyzerMinbias::analyze(), EcnaAnalyzer::analyze(), CMTRawAnalyzer::analyze(), HGCalTBAnalyzer::analyzeDigi(), SiStripClusterToDigiProducer::applyGain(), ThreeThresholdAlgorithm::applyGains(), CSCFindPeakTime::averageTime(), EcalClusterLazyToolsBase::BasicClusterTime(), FWSiPixelClusterProxyBuilder::build(), RPixDetClusterizer::buildClusters(), DCCTBDataMapper::buildXtalFields(), gpuCalibPixel::calibDigis(), gpuCalibPixel::calibDigisPhase2(), RPixDetClusterizer::calibrate(), PixelThresholdClusterizer::calibrate(), SiStripAPVRestorer::cleaner_LocalMinimumAdder(), hcal::reconstruction::compute_coder_charge(), hcal::reconstruction::compute_diff_charge_gain(), DigiConverterFP420::convert(), SiTrivialDigitalConverter::convert(), RPixDummyROCSimulator::ConvertChargeToHits(), convertHB(), SiTrivialDigitalConverter::convertRaw(), PixelThresholdClusterizer::copy_to_buffer(), CastorSimpleRecAlgoImpl::corrSaturation(), HGCalDigiValidation::digiValidation(), PulseFitWithShape::doFit(), TPNFit::doFit(), PulseFitWithFunction::doFit(), ESElectronicsSim::encode(), EcalLiteDTUCoder::encode(), EcalCoder::encode(), ESRecHitAnalyticAlgo::EvalAmplitude(), ESRecHitFitAlgo::EvalAmplitude(), ESRecHitSimAlgo::evalAmplitude(), PedestalsTask::fill(), DaqScopeModeTask::fill(), PedsFullNoiseTask::fill(), SiPixelDigiModule::fill(), sistrip::FEDBufferPayloadCreator::fillClusterData(), sistrip::FEDBufferPayloadCreator::fillClusterDataPreMixMode(), CMTRawAnalyzer::fillDigiErrorsHFQIE10(), CMTRawAnalyzer::fillDigiErrorsQIE11(), reco::HcalNoiseInfoProducer::filldigis(), Phase2TrackerMonitorDigi::fillITPixelDigiHistos(), SiPixelCalibDigiProducer::fillPixel(), QcdLowPtDQM::fillPixels(), HLTHcalLaserMisfireFilter::filter(), CSCXonStrip_MatchGatti::findXOnStrip(), JetCoreClusterSplitter::fittingSplit(), CSCFindPeakTime::fivePoleFitCharge(), CSCFindPeakTime::fivePoleFitTime(), SiStripAPVRestorer::flatRegionsFinder(), for(), TSFit::fpol3dg(), generate(), EcalSimRawData::genFeData(), EcalSimRawData::getEbDigi(), HcalQIEManager::getHfQieTable(), HcalLutManager::getLinearizationLutXmlFromAsciiMasterEmap(), HcaluLUTTPGCoder::getMSB(), CSCMake2DRecHit::hitFromStripAndWire(), SiStripAPVRestorer::hybridFormatInspect(), CTPPSPixelDataFormatter::interpretRawData(), PixelDataFormatter::interpretRawData(), SiStripFedZeroSuppression::isAValidDigi(), CastorSimpleRecAlgoImpl::isSaturated(), HcalZSAlgoRealistic::keepMe(), CastorLedAnalysis::LedCastorHists(), HcalLedAnalysis::LedHBHEHists(), HcalLedAnalysis::LedHFHists(), HcalLedAnalysis::LedHOHists(), OptoScanTask::locateTicks(), HcaluLUTTPGCoder::lookupMSB(), SiPixelDigitizerAlgorithm::make_digis(), CSCHitFromStripOnly::makeStripData(), ShallowClustersProducer::NearDigis::NearDigis(), ESRecHitSimAlgo::oldEvalAmplitude(), pixelgpudetails::pack(), UHTRpacker::packQIE8sample(), CSCFindPeakTime::parabolaFitTime(), HcalTriggerPrimitiveAlgo::passTDC(), CSCFindPeakTime::peakTime(), PrintRecoObjects::print(), MatacqTBDataFormatter::printData(), MatacqDataFormatter::printData(), EcalFenixStripFgvbEE::process(), EcalFenixStrip::process_part1(), HBHEPhase1Reconstructor::processData(), SiPixelRecHitSoAFromLegacy::produce(), PreMixingSiPixelWorker::put(), PGlobalDigi::putBRL1Digis(), PGlobalDigi::putBRL2Digis(), PGlobalDigi::putBRL3Digis(), PGlobalDigi::putCSCstripDigis(), edm::DataMixingEMDigiWorker::putEM(), PGlobalDigi::putFWD1nDigis(), PGlobalDigi::putFWD1pDigis(), PGlobalDigi::putFWD2nDigis(), PGlobalDigi::putFWD2pDigis(), edm::DataMixingSiPixelWorker::putSiPixel(), PGlobalDigi::putTECW1Digis(), PGlobalDigi::putTECW2Digis(), PGlobalDigi::putTECW3Digis(), PGlobalDigi::putTECW4Digis(), PGlobalDigi::putTECW5Digis(), PGlobalDigi::putTECW6Digis(), PGlobalDigi::putTECW7Digis(), PGlobalDigi::putTECW8Digis(), PGlobalDigi::putTIBL1Digis(), PGlobalDigi::putTIBL2Digis(), PGlobalDigi::putTIBL3Digis(), PGlobalDigi::putTIBL4Digis(), PGlobalDigi::putTIDW1Digis(), PGlobalDigi::putTIDW2Digis(), PGlobalDigi::putTIDW3Digis(), PGlobalDigi::putTOBL1Digis(), PGlobalDigi::putTOBL2Digis(), PGlobalDigi::putTOBL3Digis(), PGlobalDigi::putTOBL4Digis(), TMatacq::rawPulseAnalysis(), EcalPedOffset::readDACs(), EcalPedHists::readEBdigis(), EcalPedHists::readEEdigis(), HcalDigisValidation::reco(), ecaldqm::PresampleTask::runOnDigis(), ecaldqm::LedTask::runOnDigis(), ecaldqm::LaserTask::runOnDigis(), HGCFEElectronics< DFr >::runShaperWithToT(), HGCFEElectronics< DFr >::runSimpleShaper(), BTLElectronicsSim::runTrivialShaper(), ETLElectronicsSim::runTrivialShaper(), HGCFEElectronics< DFr >::runTrivialShaper(), HcalSignalGenerator< HBHEDigitizerTraits >::samplesInPE(), HGCalConcentratorAutoEncoderImpl::select(), SiPixelArrayBuffer::set_adc(), DCUCapsuleTempRawDat::setCapsuleTempADC(), CastorQIEShape::setLowEdges(), HcalQIEShape::setLowEdges(), TPNPulse::setPulse(), TAPDPulse::setPulse(), QIE10DataFrame::setSample(), QIE11DataFrame::setSample(), SiPixelCluster::SiPixelCluster(), EBDataFrame::spikeEstimator(), ThreeThresholdAlgorithm::stripByStripAdd(), SiStripApvShotCleaner::subtractCM(), hcaldqm::utilities::sumQ_v10(), SiStripFedZeroSuppression::suppress(), HcalTDC::timing(), ZeroSuppressFP420::trkFEDclusterizer(), DigiConverterFP420::truncate(), SiTrivialDigitalConverter::truncate(), SiTrivialDigitalConverter::truncateRaw(), HcalFiberPattern::unpack(), HcaluLUTTPGCoder::update(), HcalSignalGenerator< HBHEDigitizerTraits >::validDigi(), EcalSignalGenerator< EEDigitizerTraits >::validDigi(), and ESUnpacker::word2digi().

◆ clusterId

uint16_t *__restrict__ uint16_t const *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t *__restrict__ int32_t *__restrict__ gpuClustering::clusterId

◆ endModule

auto gpuClustering::endModule = moduleStart[0]

Definition at line 40 of file gpuClusterChargeCut.h.

◆ firstModule

auto gpuClustering::firstModule = blockIdx.x

Definition at line 39 of file gpuClusterChargeCut.h.

◆ id

uint16_t *__restrict__ gpuClustering::id

Definition at line 21 of file gpuClusterChargeCut.h.

◆ invalidClusterId

constexpr int gpuClustering::invalidClusterId = -9999

Definition at line 23 of file gpuClusteringConstants.h.

◆ invalidModuleId

constexpr uint16_t gpuClustering::invalidModuleId = std::numeric_limits<uint16_t>::max() - 1

◆ maxNumClustersPerModules

constexpr int32_t gpuClustering::maxNumClustersPerModules = maxHitsInModule()

Definition at line 21 of file gpuClusteringConstants.h.

Referenced by for(), and SiPixelDigisClustersFromSoA::produce().

◆ maxNumDigis

constexpr uint32_t gpuClustering::maxNumDigis = 3 * 256 * 1024

Definition at line 18 of file gpuClusteringConstants.h.

Referenced by SiPixelPhase2DigiToClusterCUDA::acquire().

◆ maxNumModules

constexpr uint16_t gpuClustering::maxNumModules = 4000

◆ moduleId

uint16_t *__restrict__ uint16_t const *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t *__restrict__ gpuClustering::moduleId

◆ moduleStart

uint16_t *__restrict__ uint16_t const *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ gpuClustering::moduleStart

◆ msize

__shared__ int gpuClustering::msize

◆ nClustersInModule

uint16_t *__restrict__ uint16_t const *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ gpuClustering::nClustersInModule

◆ newclusId

__shared__ uint16_t gpuClustering::newclusId[maxNumClustersPerModules]

Definition at line 30 of file gpuClusterChargeCut.h.

Referenced by for().

◆ nMaxModules

constexpr int gpuClustering::nMaxModules

◆ numElements

uint16_t *__restrict__ uint16_t const *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t *__restrict__ int32_t *__restrict__ int gpuClustering::numElements

◆ ok

__shared__ uint8_t gpuClustering::ok[maxNumClustersPerModules]

Definition at line 29 of file gpuClusterChargeCut.h.

Referenced by for().

◆ pixelSizeX

constexpr uint32_t gpuClustering::pixelSizeX = 160

Definition at line 16 of file gpuClustering.h.

Referenced by gpuClustering::pixelStatus::getIndex().

◆ pixelSizeY

constexpr uint32_t gpuClustering::pixelSizeY = 416

Definition at line 17 of file gpuClustering.h.

◆ startBPIX2

constexpr int gpuClustering::startBPIX2 = isPhase2 ? phase2PixelTopology::layerStart[1] : phase1PixelTopology::layerStart[1]

Definition at line 32 of file gpuClusterChargeCut.h.

Referenced by for(), and SiPixelRecHitSoAFromLegacy::produce().

◆ status

__shared__ uint32_t gpuClustering::status[pixelStatusSize]

◆ x

uint16_t* __restrict__ uint16_t const* __restrict__ gpuClustering::x

Definition at line 94 of file gpuClustering.h.

◆ y

uint16_t* __restrict__ uint16_t const* __restrict__ uint16_t const* __restrict__ gpuClustering::y

Definition at line 94 of file gpuClustering.h.