Skip to content

Commit

Permalink
Make HcalDigisSoAProducer to rely on implicit host-to-device copy
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Jan 31, 2025
1 parent fd1b754 commit bed107f
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions EventFilter/HcalRawToDigi/plugins/alpaka/HcalDigisSoAProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
using HostCollectionPhase1 = hcal::Phase1DigiHostCollection;
using HostCollectionPhase0 = hcal::Phase0DigiHostCollection;

using DeviceCollectionPhase1 = hcal::Phase1DigiDeviceCollection;
using DeviceCollectionPhase0 = hcal::Phase0DigiDeviceCollection;

// output product tokens
device::EDPutToken<DeviceCollectionPhase1> digisF01HEToken_;
device::EDPutToken<DeviceCollectionPhase0> digisF5HBToken_;
device::EDPutToken<DeviceCollectionPhase1> digisF3HBToken_;
edm::EDPutTokenT<HostCollectionPhase1> digisF01HEToken_;
edm::EDPutTokenT<HostCollectionPhase0> digisF5HBToken_;
edm::EDPutTokenT<HostCollectionPhase1> digisF3HBToken_;

struct ConfigParameters {
uint32_t maxChannelsF01HE, maxChannelsF5HB, maxChannelsF3HB;
Expand Down Expand Up @@ -86,9 +83,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
// stack host memory in the queue
HostCollectionPhase0 hf5_(size, event.queue());

// device product
DeviceCollectionPhase0 df5_(size, event.queue());

// set SoA_Scalar;
hf5_.view().stride() = stride;
hf5_.view().size() = hbheDigis.size();
Expand All @@ -111,9 +105,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
hf5_vi.data()[i + 1] = sample;
}
}
// copy hf5 to df5
alpaka::memcpy(event.queue(), df5_.buffer(), hf5_.const_buffer());
event.emplace(digisF5HBToken_, std::move(df5_));
event.emplace(digisF5HBToken_, std::move(hf5_));

if (qie11Digis.empty()) {
event.emplace(digisF01HEToken_, 0, event.queue());
Expand Down Expand Up @@ -144,10 +136,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
HostCollectionPhase1 hf1_(size_f1, event.queue());
HostCollectionPhase1 hf3_(size_f3, event.queue());

// device product
DeviceCollectionPhase1 df1_(size_f1, event.queue());
DeviceCollectionPhase1 df3_(size_f3, event.queue());

// set SoA_Scalar;
hf1_.view().stride() = stride01;
hf3_.view().stride() = stride01;
Expand Down Expand Up @@ -186,11 +174,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
hf1_.view().size() = size_f1;
hf3_.view().size() = size_f3;

alpaka::memcpy(event.queue(), df1_.buffer(), hf1_.const_buffer());
alpaka::memcpy(event.queue(), df3_.buffer(), hf3_.const_buffer());

event.emplace(digisF01HEToken_, std::move(df1_));
event.emplace(digisF3HBToken_, std::move(df3_));
event.emplace(digisF01HEToken_, std::move(hf1_));
event.emplace(digisF3HBToken_, std::move(hf3_));
}
}
} // namespace ALPAKA_ACCELERATOR_NAMESPACE
Expand Down

0 comments on commit bed107f

Please sign in to comment.