Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:04

0001 /**
0002  * traccc library, part of the ACTS project (R&D line)
0003  *
0004  * (c) 2025 CERN for the benefit of the ACTS project
0005  *
0006  * Mozilla Public License Version 2.0
0007  */
0008 
0009 // Local include(s).
0010 #include "traccc/alpaka/utils/queue.hpp"
0011 
0012 #include "utils.hpp"
0013 
0014 // Alpaka include(s).
0015 #include <alpaka/alpaka.hpp>
0016 
0017 namespace traccc::alpaka {
0018 
0019 struct queue::impl {
0020   /// Bare pointer to the wrapped queue object
0021   Queue* m_queue = nullptr;
0022   /// Unique pointer to the managed Queue object
0023   std::unique_ptr<Queue> m_managedQueue;
0024 };  // struct queue::impl
0025 
0026 queue::queue(std::size_t device) : m_impl{std::make_unique<impl>()} {
0027   m_impl->m_managedQueue = std::make_unique<Queue>(::alpaka::getDevByIdx(
0028       ::alpaka::Platform<Acc>{}, device == INVALID_DEVICE ? 0 : device));
0029   m_impl->m_queue = m_impl->m_managedQueue.get();
0030 }
0031 
0032 queue::queue(void* input_queue) : m_impl{std::make_unique<impl>()} {
0033   assert(input_queue != nullptr);
0034   m_impl->m_queue = static_cast<Queue*>(input_queue);
0035 }
0036 
0037 queue::queue(queue&&) noexcept = default;
0038 
0039 queue::~queue() = default;
0040 
0041 queue& queue::operator=(queue&& rhs) noexcept = default;
0042 
0043 void* queue::alpakaQueue() {
0044   assert(m_impl->m_queue != nullptr);
0045   return m_impl->m_queue;
0046 }
0047 
0048 const void* queue::alpakaQueue() const {
0049   assert(m_impl->m_queue != nullptr);
0050   return m_impl->m_queue;
0051 }
0052 
0053 void queue::synchronize() {
0054   assert(m_impl->m_queue != nullptr);
0055   ::alpaka::wait(*m_impl->m_queue);
0056 }
0057 
0058 }  // namespace traccc::alpaka