Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-11-24 00:02:23

0001 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/chooseDevice.h"
0002 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EDMetadataAcquireSentry.h"
0003 #include "HeterogeneousCore/AlpakaCore/interface/EventCache.h"
0004 #include "HeterogeneousCore/AlpakaCore/interface/QueueCache.h"
0005 
0006 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0007   namespace detail {
0008     EDMetadataAcquireSentry::EDMetadataAcquireSentry(edm::StreamID streamID, edm::WaitingTaskWithArenaHolder holder)
0009         : EDMetadataAcquireSentry(detail::chooseDevice(streamID), std::move(holder)) {}
0010 
0011     EDMetadataAcquireSentry::EDMetadataAcquireSentry(Device const& device, edm::WaitingTaskWithArenaHolder holder)
0012         : waitingTaskHolder_(std::move(holder)) {
0013 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
0014       // all synchronous backends
0015       metadata_ = std::make_shared<EDMetadata>(cms::alpakatools::getQueueCache<Queue>().get(device));
0016 #else
0017       // all asynchronous backends
0018       metadata_ = std::make_shared<EDMetadata>(cms::alpakatools::getQueueCache<Queue>().get(device),
0019                                                cms::alpakatools::getEventCache<Event>().get(device));
0020 #endif
0021     }
0022 
0023 #ifndef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
0024     // all asynchronous backends
0025     std::shared_ptr<EDMetadata> EDMetadataAcquireSentry::finish() {
0026       metadata_->enqueueCallback(std::move(waitingTaskHolder_));
0027       return std::move(metadata_);
0028     }
0029 #endif
0030   }  // namespace detail
0031 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE