Skip to content

Commit

Permalink
Move hit indexes to 32 bits (#583)
Browse files Browse the repository at this point in the history
Add a counter for forlorn doublets.
  • Loading branch information
VinInn authored and fwyzard committed Jan 15, 2021
1 parent 2fd9bcc commit c62b37b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CUDADataFormats/Track/interface/PixelTrackHeterogeneous.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TrackSoAT {
static constexpr int32_t stride() { return S; }

using Quality = trackQuality::Quality;
using hindex_type = uint16_t;
using hindex_type = uint32_t;
using HitContainer = cms::cuda::OneToManyAssoc<hindex_type, S, 5 * S>;

// Always check quality is at least loose!
Expand Down
2 changes: 1 addition & 1 deletion RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace CAConstants {
constexpr uint32_t maxTuples() { return maxNumberOfTuples(); }

// types
using hindex_type = uint16_t; // FIXME from siPixelRecHitsHeterogeneousProduct
using hindex_type = uint32_t; // FIXME from siPixelRecHitsHeterogeneousProduct
using tindex_type = uint16_t; // for tuples

#ifndef ONLY_PHICUT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ void CAHitNtupletGeneratorKernelsCPU::launchKernels(HitsOnCPU const &hh, TkSoA *
if (m_params.doStats_) {
kernel_checkOverflows(tuples_d,
device_tupleMultiplicity_.get(),
device_hitToTuple_.get(),
device_hitTuple_apc_,
device_theCells_.get(),
device_nCells_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,6 @@ void CAHitNtupletGeneratorKernelsGPU::launchKernels(HitsOnCPU const &hh, TkSoA *
cudaCheck(cudaGetLastError());
}

if (m_params.doStats_) {
numberOfBlocks = (std::max(nhits, m_params.maxNumberOfDoublets_) + blockSize - 1) / blockSize;
kernel_checkOverflows<<<numberOfBlocks, blockSize, 0, cudaStream>>>(tuples_d,
device_tupleMultiplicity_.get(),
device_hitTuple_apc_,
device_theCells_.get(),
device_nCells_,
device_theCellNeighbors_.get(),
device_theCellTracks_.get(),
device_isOuterHitOfCell_.get(),
nhits,
m_params.maxNumberOfDoublets_,
counters_);
cudaCheck(cudaGetLastError());
}
#ifdef GPU_DEBUG
cudaDeviceSynchronize();
cudaCheck(cudaGetLastError());
Expand Down Expand Up @@ -278,6 +263,24 @@ void CAHitNtupletGeneratorKernelsGPU::classifyTuples(HitsOnCPU const &hh, TkSoA
cudaCheck(cudaGetLastError());
}

if (m_params.doStats_) {
auto nhits = hh.nHits();
numberOfBlocks = (std::max(nhits, m_params.maxNumberOfDoublets_) + blockSize - 1) / blockSize;
kernel_checkOverflows<<<numberOfBlocks, blockSize, 0, cudaStream>>>(tuples_d,
device_tupleMultiplicity_.get(),
device_hitToTuple_.get(),
device_hitTuple_apc_,
device_theCells_.get(),
device_nCells_,
device_theCellNeighbors_.get(),
device_theCellTracks_.get(),
device_isOuterHitOfCell_.get(),
nhits,
m_params.maxNumberOfDoublets_,
counters_);
cudaCheck(cudaGetLastError());
}

if (m_params.doStats_) {
// counters (add flag???)
numberOfBlocks = (HitToTuple::capacity() + blockSize - 1) / blockSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ using TkSoA = pixelTrack::TrackSoA;
using HitContainer = pixelTrack::HitContainer;

__global__ void kernel_checkOverflows(HitContainer const *foundNtuplets,
CAConstants::TupleMultiplicity *tupleMultiplicity,
CAConstants::TupleMultiplicity const *tupleMultiplicity,
CAHitNtupletGeneratorKernelsGPU::HitToTuple const *hitToTuple,
cms::cuda::AtomicPairCounter *apc,
GPUCACell const *__restrict__ cells,
uint32_t const *__restrict__ nCells,
Expand Down Expand Up @@ -95,7 +96,7 @@ __global__ void kernel_checkOverflows(HitContainer const *foundNtuplets,
atomicAdd(&c.nKilledCells, 1);
if (0 == thisCell.theUsed)
atomicAdd(&c.nEmptyCells, 1);
if (thisCell.tracks().empty())
if (0 == hitToTuple->size(thisCell.get_inner_hit_id()) && 0 == hitToTuple->size(thisCell.get_outer_hit_id()))
atomicAdd(&c.nZeroTrackCells, 1);
}

Expand Down

0 comments on commit c62b37b

Please sign in to comment.