Skip to content

Commit

Permalink
TrackingRecHitsSoACollection: early return hostData when there aren't…
Browse files Browse the repository at this point in the history
… hits
  • Loading branch information
mmusich committed Sep 2, 2024
1 parent 3914bc8 commit 5eeac09
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 5eeac09

Please sign in to comment.