Execution queue for an accelerator. More...
Classes | |
| class | ScopedAsync |
Public Member Functions | |
| RunQueue () | |
| Creates a null queue. | |
| RunQueue (const Runner &runner) | |
| Creates a queue associated with runner with default parameters. | |
| RunQueue (const Runner &runner, const RunQueueBuildInfo &bi) | |
| Creates a queue associated with runner with parameters bi. | |
| RunQueue (const RunQueue &) | |
| RunQueue (RunQueue &&) noexcept | |
| RunQueue & | operator= (const RunQueue &) |
| RunQueue & | operator= (RunQueue &&) noexcept |
| bool | isNull () const |
| Indicates if the RunQueue is null. | |
| eExecutionPolicy | executionPolicy () const |
| Execution policy of the queue. | |
| bool | isAcceleratorPolicy () const |
| Indicates if the instance is associated with an accelerator. | |
| void | setAsync (bool v) |
| Sets the instance's asynchronous state. | |
| bool | isAsync () const |
| Indicates if the execution queue is asynchronous. | |
| const RunQueue & | addAsync (bool is_async) const |
| Sets the instance's asynchronous state. | |
| void | barrier () const |
| Blocks until all commands associated with the queue are finished. | |
| void | copyMemory (const MemoryCopyArgs &args) const |
| Copies information between two memory regions. | |
| void | prefetchMemory (const MemoryPrefetchArgs &args) const |
| Performs a memory prefetch. | |
| void | setConcurrentCommandCreation (bool v) |
| Indicates if the creation of RunCommand for this instance is allowed from multiple threads. | |
| bool | isConcurrentCommandCreation () const |
| Indicates if concurrent creation of multiple RunCommands is allowed. | |
| void * | platformStream () const |
| Pointer to the internal structure dependent on the implementation. | |
| Impl::RunQueueImpl * | _internalImpl () const |
Event Management | |
| |
| void | recordEvent (RunQueueEvent &event) |
| void | recordEvent (Ref< RunQueueEvent > &event) |
| Records the instance's state in event. | |
| void | waitEvent (RunQueueEvent &event) |
| Blocks execution on the instance until the jobs recorded in event are finished. | |
| void | waitEvent (Ref< RunQueueEvent > &event) |
| Blocks execution on the instance until the jobs recorded in event are finished. | |
Memory Management | |
| MemoryAllocationOptions | allocationOptions () const |
| Allocation options associated with this queue. | |
| void | setMemoryRessource (eMemoryResource mem) |
| Sets the memory resource used for allocations with this instance. | |
| eMemoryResource | memoryRessource () const |
| Memory resource used for allocations with this instance. | |
| eMemoryResource | memoryResource () const |
| Memory resource used for allocations with this instance. | |
Private Member Functions | |
| RunQueue (const Runner &runner, bool) | |
| RunQueue (const Runner &runner, const RunQueueBuildInfo &bi, bool) | |
| Creates a queue associated with runner with parameters bi. | |
| RunQueue (Impl::RunQueueImpl *p) | |
| Impl::IRunnerRuntime * | _internalRuntime () const |
| Impl::IRunQueueStream * | _internalStream () const |
| Impl::RunCommandImpl * | _getCommandImpl () const |
| Impl::NativeStream | _internalNativeStream () const |
| void | _checkNotNull () const |
Private Attributes | |
| friend | RunCommand |
| friend | ProfileRegion |
| friend | Runner |
| friend | ViewBuildInfo |
| AutoRef2< Impl::RunQueueImpl > | m_p |
Friends | |
| class | Impl::RunCommandLaunchInfo |
| class | Impl::CudaUtils |
| class | Impl::HipUtils |
| class | Impl::SyclUtils |
| class | VariableViewBase |
| class | NumArrayViewBase |
| RunCommand | makeCommand (const RunQueue &run_queue) |
| Creates a command associated with the queue run_queue. | |
| RunCommand | makeCommand (const RunQueue *run_queue) |
| Creates a command associated with the queue run_queue. | |
| bool | operator== (const RunQueue &q1, const RunQueue &q2) |
| bool | operator!= (const RunQueue &q1, const RunQueue &q2) |
Execution queue for an accelerator.
This class uses a reference semantics. The execution queue is destroyed when the last reference to it is destroyed.
A queue is attached to a Runner instance and allows executing commands (RunCommand) on an accelerator or on the CPU. The method executionPolicy() allows knowing where the commands from the queue will be executed.
Instances of this class are created by calling makeQueue(Runner). Calculation kernels (RunCommand) can then be created via the call to makeCommand().
The default constructor builds a null queue that cannot be used to launch commands. The only operations allowed on the null queue are isNull(), executionPolicy(), isAcceleratorPolicy(), barrier(), allocationOptions(), and memoryResource().
The methods of this class are not thread-safe for the same instance.
Definition at line 52 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
Creates a null queue.
Definition at line 45 of file RunQueue.cc.
|
explicit |
Creates a queue associated with runner with default parameters.
Definition at line 53 of file RunQueue.cc.
| Arcane::Accelerator::RunQueue::RunQueue | ( | const Runner & | runner, |
| const RunQueueBuildInfo & | bi ) |
Creates a queue associated with runner with parameters bi.
Definition at line 62 of file RunQueue.cc.
| Arcane::Accelerator::RunQueue::RunQueue | ( | const RunQueue & | x | ) |
Definition at line 89 of file RunQueue.cc.
|
noexcept |
Definition at line 98 of file RunQueue.cc.
|
private |
Definition at line 71 of file RunQueue.cc.
|
private |
Creates a queue associated with runner with parameters bi.
Definition at line 80 of file RunQueue.cc.
|
explicitprivate |
Definition at line 107 of file RunQueue.cc.
| Arcane::Accelerator::RunQueue::~RunQueue | ( | ) |
Definition at line 137 of file RunQueue.cc.
|
private |
Definition at line 148 of file RunQueue.cc.
|
private |
Definition at line 197 of file RunQueue.cc.
| Impl::RunQueueImpl * Arcane::Accelerator::RunQueue::_internalImpl | ( | ) | const |
Definition at line 206 of file RunQueue.cc.
|
private |
Definition at line 216 of file RunQueue.cc.
|
private |
Definition at line 179 of file RunQueue.cc.
|
private |
Definition at line 188 of file RunQueue.cc.
| const RunQueue & Arcane::Accelerator::RunQueue::addAsync | ( | bool | is_async | ) | const |
Sets the instance's asynchronous state.
Returns the instance.
Definition at line 308 of file RunQueue.cc.
Allocation options associated with this queue.
It is possible to change the memory resource and thus the allocator used via setMemoryRessource().
Definition at line 339 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::barrier | ( | ) | const |
Blocks until all commands associated with the queue are finished.
Definition at line 158 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::copyMemory | ( | const MemoryCopyArgs & | args | ) | const |
Copies information between two memory regions.
Definition at line 236 of file RunQueue.cc.
Execution policy of the queue.
Definition at line 168 of file RunQueue.cc.
| bool Arcane::Accelerator::RunQueue::isAcceleratorPolicy | ( | ) | const |
Indicates if the instance is associated with an accelerator.
Definition at line 330 of file RunQueue.cc.
| bool Arcane::Accelerator::RunQueue::isAsync | ( | ) | const |
Indicates if the execution queue is asynchronous.
Definition at line 319 of file RunQueue.cc.
| bool Arcane::Accelerator::RunQueue::isConcurrentCommandCreation | ( | ) | const |
Indicates if concurrent creation of multiple RunCommands is allowed.
Definition at line 394 of file RunQueue.cc.
|
inline |
Indicates if the RunQueue is null.
Definition at line 122 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
Memory resource used for allocations with this instance.
Definition at line 371 of file RunQueue.cc.
Memory resource used for allocations with this instance.
Definition at line 360 of file RunQueue.cc.
Definition at line 116 of file RunQueue.cc.
Definition at line 127 of file RunQueue.cc.
| void * Arcane::Accelerator::RunQueue::platformStream | ( | ) | const |
Pointer to the internal structure dependent on the implementation.
This method is reserved for advanced usage. The returned queue must not be kept beyond the life of the instance.
With CUDA, the returned pointer is a 'cudaStream_t*'. With HIP, it is a 'hipStream_t*'.
Definition at line 227 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::prefetchMemory | ( | const MemoryPrefetchArgs & | args | ) | const |
Performs a memory prefetch.
Definition at line 246 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::recordEvent | ( | Ref< RunQueueEvent > & | event | ) |
Records the instance's state in event.
Definition at line 287 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::recordEvent | ( | RunQueueEvent & | event | ) |
Records the instance's state in event.
Definition at line 277 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::setAsync | ( | bool | v | ) |
Sets the instance's asynchronous state.
If the instance is asynchronous, the different commands associated are non-blocking and you must explicitly call barrier() to wait for the commands to finish execution.
Definition at line 298 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::setConcurrentCommandCreation | ( | bool | v | ) |
Indicates if the creation of RunCommand for this instance is allowed from multiple threads.
This requires using a lock (like std::mutex) and may degrade performance. The default is false.
This method is not supported for queues that are associated with accelerators (isAcceleratorPolicy()==true)
Definition at line 382 of file RunQueue.cc.
Sets the memory resource used for allocations with this instance.
The default value is eMemoryRessource::UnifiedMemory if isAcceleratorPolicy()==true and eMemoryRessource::Host otherwise.
Definition at line 350 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::waitEvent | ( | Ref< RunQueueEvent > & | event | ) |
Blocks execution on the instance until the jobs recorded in event are finished.
Definition at line 266 of file RunQueue.cc.
| void Arcane::Accelerator::RunQueue::waitEvent | ( | RunQueueEvent & | event | ) |
Blocks execution on the instance until the jobs recorded in event are finished.
Definition at line 256 of file RunQueue.cc.
|
friend |
Definition at line 62 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
friend |
Definition at line 63 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
friend |
Definition at line 58 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
friend |
Definition at line 64 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
friend |
Creates a command associated with the queue run_queue.
Definition at line 289 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
friend |
Creates a command associated with the queue run_queue.
Definition at line 299 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
friend |
Definition at line 272 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
Definition at line 243 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
Definition at line 239 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
friend |
Definition at line 271 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
private |
Definition at line 276 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
private |
Definition at line 55 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
private |
Definition at line 54 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
private |
Definition at line 56 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.
|
private |
Definition at line 57 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.