12#ifndef ARCANE_ACCELERATOR_ASYNC_RUNQUEUE_POOL_H
13#define ARCANE_ACCELERATOR_ASYNC_RUNQUEUE_POOL_H
17#include "arcane/accelerator/core/AcceleratorCoreGlobal.h"
18#include "arcane/accelerator/core/Runner.h"
19#include "arcane/accelerator/core/RunQueue.h"
20#include "arcane/accelerator/core/RunQueueBuildInfo.h"
25namespace Arcane::Accelerator
42class AsyncRunQueuePool
50 AsyncRunQueuePool() =
delete;
51 AsyncRunQueuePool(
const AsyncRunQueuePool&) =
delete;
52 AsyncRunQueuePool(AsyncRunQueuePool&&) =
delete;
53 AsyncRunQueuePool& operator=(
const AsyncRunQueuePool&) =
delete;
54 AsyncRunQueuePool& operator=(AsyncRunQueuePool&&) =
delete;
57 eRunQueuePriority queues_priority = eRunQueuePriority::Default)
60 m_pool.reserve(m_pool_size);
61 for (
Int32 i(0); i < m_pool_size; ++i) {
64 bi.setPriority(
static_cast<std::underlying_type_t<eRunQueuePriority>
>(queues_priority));
65 auto queue_ref = makeQueueRef(runner, bi);
66 queue_ref->setAsync(
true);
67 m_pool.add(queue_ref);
81 return *(m_pool[i % m_pool_size].get());
87 return m_pool[i % m_pool_size].get();
103 UniqueArray<Ref<RunQueue>> m_pool;
118makeAsyncQueuePool(Runner& runner)
128inline AsyncRunQueuePool
129makeAsyncQueuePool(Runner& runner, Int32 size, eRunQueuePriority priority = eRunQueuePriority::Default)
131 return AsyncRunQueuePool(runner, size, priority);
143makeAsyncQueuePool(Runner* runner)
155makeAsyncQueuePool(Runner* runner,
Int32 size, eRunQueuePriority priority = eRunQueuePriority::Default)
#define ARCANE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
Collection de file d'exécution asynchrone avec priorité sur accélérateur.
Int32 poolSize() const
Taille de la collection.
RunQueue * operator[](Int32 i)
Pour récupérer la i % poolSize() ième queue d'exécution.
static constexpr Int32 POOL_MAX_SIZE
au plus 32 queues (32 = nb de kernels max exécutables simultanément)
const RunQueue & operator[](Int32 i) const
Pour récupérer la i % poolSize() ième queue d'exécution.
void waitAll() const
Force l'attente de toutes les RunQueue.
std::int32_t Int32
Type entier signé sur 32 bits.