Skip to content

Commit

Permalink
Merge pull request #45857 from mmusich/mm_fix_TrackingRecHitsSoAColle…
Browse files Browse the repository at this point in the history
…ction_14_1_X

[14.1.X] `TrackingRecHitsSoACollection`: early return `hostData` in `CopyHost::copyAsync()` when there aren't hits
  • Loading branch information
cmsbuild authored Sep 4, 2024
2 parents b33390a + 5eeac09 commit 47370a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ namespace cms::alpakatools {
template <typename TQueue>
static auto copyAsync(TQueue& queue, TrackingRecHitDevice<TrackerTraits, TDevice> const& deviceData) {
TrackingRecHitHost<TrackerTraits> hostData(queue, deviceData.view().metadata().size());

// Don't bother if zero hits
if (deviceData.view().metadata().size() == 0) {
std::memset(hostData.buffer().data(),
0,
alpaka::getExtentProduct(hostData.buffer()) *
sizeof(alpaka::Elem<typename TrackingRecHitHost<TrackerTraits>::Buffer>));
return hostData;
}

alpaka::memcpy(queue, hostData.buffer(), deviceData.buffer());
#ifdef GPU_DEBUG
printf("TrackingRecHitsSoACollection: I'm copying to host.\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

TrackSoA tracks(queue);

// Don't bother if less than 2 this
if (hits_d.view().metadata().size() < 2)
return tracks;

GPUKernels kernels(m_params, hits_d.view().metadata().size(), hits_d.offsetBPIX2(), queue);

kernels.buildDoublets(hits_d.view(), hits_d.offsetBPIX2(), queue);
Expand Down

0 comments on commit 47370a8

Please sign in to comment.