diff --git a/HeterogeneousCore/AlpakaCore/interface/EventCache.h b/HeterogeneousCore/AlpakaCore/interface/EventCache.h index 2701a739222f9..f6bc3ba69b720 100644 --- a/HeterogeneousCore/AlpakaCore/interface/EventCache.h +++ b/HeterogeneousCore/AlpakaCore/interface/EventCache.h @@ -69,7 +69,11 @@ namespace cms::alpakatools { private: std::shared_ptr makeOrGet(Device dev) { - return cache_[alpaka::getNativeHandle(dev)].makeOrGet([dev]() { return std::make_unique(dev); }); + return cache_[alpaka::getNativeHandle(dev)].makeOrGet([dev]() { + // We want non-busy waits + bool constexpr busyWait = false; + return std::make_unique(dev, busyWait); + }); } // not thread safe, intended to be called only from AlpakaService diff --git a/HeterogeneousCore/AlpakaCore/interface/alpaka/EDMetadata.h b/HeterogeneousCore/AlpakaCore/interface/alpaka/EDMetadata.h index ddfb9f706621b..bc1882e645594 100644 --- a/HeterogeneousCore/AlpakaCore/interface/alpaka/EDMetadata.h +++ b/HeterogeneousCore/AlpakaCore/interface/alpaka/EDMetadata.h @@ -8,7 +8,6 @@ #include "FWCore/Concurrency/interface/WaitingTaskWithArenaHolder.h" #include "HeterogeneousCore/AlpakaInterface/interface/config.h" -#include "HeterogeneousCore/AlpakaInterface/interface/HostOnlyTask.h" namespace ALPAKA_ACCELERATOR_NAMESPACE { /** diff --git a/HeterogeneousCore/AlpakaCore/src/alpaka/EDMetadata.cc b/HeterogeneousCore/AlpakaCore/src/alpaka/EDMetadata.cc index 8847d9b3f8e71..693265bffe600 100644 --- a/HeterogeneousCore/AlpakaCore/src/alpaka/EDMetadata.cc +++ b/HeterogeneousCore/AlpakaCore/src/alpaka/EDMetadata.cc @@ -1,5 +1,6 @@ #include +#include "FWCore/Concurrency/interface/async.h" #include "FWCore/Utilities/interface/EDMException.h" #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EDMetadata.h" @@ -23,11 +24,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { } void EDMetadata::enqueueCallback(edm::WaitingTaskWithArenaHolder holder) { - alpaka::enqueue(*queue_, alpaka::HostOnlyTask([holder = std::move(holder)](std::exception_ptr eptr) { - // The functor is required to be const, but the original waitingTaskHolder_ - // needs to be notified... - const_cast(holder).doneWaiting(eptr); - })); + recordEvent(); + edm::async(std::move(holder), [event = event_]() mutable { alpaka::wait(*event); }); } void EDMetadata::synchronize(EDMetadata& consumer, bool tryReuseQueue) const {