Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::RunQueue Class Reference

Execution queue for an accelerator. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/common/arccore/common/accelerator/RunQueue.h>

Collaboration diagram for Arcane::RunQueue:

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
RunQueueoperator= (const RunQueue &)
RunQueueoperator= (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 RunQueueaddAsync (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
Precondition
!isNull()
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)

Detailed Description

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.

Constructor & Destructor Documentation

◆ RunQueue() [1/8]

Creates a null queue.

Definition at line 45 of file RunQueue.cc.

◆ RunQueue() [2/8]

Arcane::Accelerator::RunQueue::RunQueue ( const Runner & runner)
explicit

Creates a queue associated with runner with default parameters.

Definition at line 53 of file RunQueue.cc.

◆ RunQueue() [3/8]

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.

◆ RunQueue() [4/8]

Definition at line 89 of file RunQueue.cc.

◆ RunQueue() [5/8]

Arcane::Accelerator::RunQueue::RunQueue ( RunQueue && x)
noexcept

Definition at line 98 of file RunQueue.cc.

◆ RunQueue() [6/8]

Arcane::Accelerator::RunQueue::RunQueue ( const Runner & runner,
bool  )
private

Definition at line 71 of file RunQueue.cc.

◆ RunQueue() [7/8]

Arcane::Accelerator::RunQueue::RunQueue ( const Runner & runner,
const RunQueueBuildInfo & bi,
bool  )
private

Creates a queue associated with runner with parameters bi.

Definition at line 80 of file RunQueue.cc.

◆ RunQueue() [8/8]

Arcane::Accelerator::RunQueue::RunQueue ( Impl::RunQueueImpl * p)
explicitprivate

Definition at line 107 of file RunQueue.cc.

◆ ~RunQueue()

Arcane::Accelerator::RunQueue::~RunQueue ( )

Definition at line 137 of file RunQueue.cc.

Member Function Documentation

◆ _checkNotNull()

void Arcane::Accelerator::RunQueue::_checkNotNull ( ) const
private

Definition at line 148 of file RunQueue.cc.

◆ _getCommandImpl()

Impl::RunCommandImpl * Arcane::Accelerator::RunQueue::_getCommandImpl ( ) const
private

Definition at line 197 of file RunQueue.cc.

◆ _internalImpl()

Impl::RunQueueImpl * Arcane::Accelerator::RunQueue::_internalImpl ( ) const

Definition at line 206 of file RunQueue.cc.

◆ _internalNativeStream()

Impl::NativeStream Arcane::Accelerator::RunQueue::_internalNativeStream ( ) const
private

Definition at line 216 of file RunQueue.cc.

◆ _internalRuntime()

Impl::IRunnerRuntime * Arcane::Accelerator::RunQueue::_internalRuntime ( ) const
private

Definition at line 179 of file RunQueue.cc.

◆ _internalStream()

Impl::IRunQueueStream * Arcane::Accelerator::RunQueue::_internalStream ( ) const
private

Definition at line 188 of file RunQueue.cc.

◆ addAsync()

const RunQueue & Arcane::Accelerator::RunQueue::addAsync ( bool is_async) const

Sets the instance's asynchronous state.

Returns the instance.

Precondition
!isNull()
See also
setAsync().

Definition at line 308 of file RunQueue.cc.

◆ allocationOptions()

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.

◆ barrier()

Blocks until all commands associated with the queue are finished.

Definition at line 158 of file RunQueue.cc.

◆ copyMemory()

Copies information between two memory regions.

Definition at line 236 of file RunQueue.cc.

◆ executionPolicy()

Execution policy of the queue.

Definition at line 168 of file RunQueue.cc.

◆ isAcceleratorPolicy()

Indicates if the instance is associated with an accelerator.

Definition at line 330 of file RunQueue.cc.

◆ isAsync()

Indicates if the execution queue is asynchronous.

Definition at line 319 of file RunQueue.cc.

◆ isConcurrentCommandCreation()

Indicates if concurrent creation of multiple RunCommands is allowed.

Definition at line 394 of file RunQueue.cc.

◆ isNull()

Indicates if the RunQueue is null.

Definition at line 122 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.

◆ memoryResource()

Memory resource used for allocations with this instance.

Definition at line 371 of file RunQueue.cc.

◆ memoryRessource()

Memory resource used for allocations with this instance.

Definition at line 360 of file RunQueue.cc.

◆ operator=() [1/2]

RunQueue & Arcane::Accelerator::RunQueue::operator= ( const RunQueue & x)

Definition at line 116 of file RunQueue.cc.

◆ operator=() [2/2]

RunQueue & Arcane::Accelerator::RunQueue::operator= ( RunQueue && x)
noexcept

Definition at line 127 of file RunQueue.cc.

◆ platformStream()

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*'.

Deprecated
Use toCudaNativeStream(), toHipNativeStream() or toSyclNativeStream() instead

Definition at line 227 of file RunQueue.cc.

◆ prefetchMemory()

Performs a memory prefetch.

Definition at line 246 of file RunQueue.cc.

◆ recordEvent() [1/2]

Records the instance's state in event.

Definition at line 287 of file RunQueue.cc.

◆ recordEvent() [2/2]

Records the instance's state in event.

Definition at line 277 of file RunQueue.cc.

◆ setAsync()

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.

Precondition
!isNull()

Definition at line 298 of file RunQueue.cc.

◆ setConcurrentCommandCreation()

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.

◆ setMemoryRessource()

Sets the memory resource used for allocations with this instance.

The default value is eMemoryRessource::UnifiedMemory if isAcceleratorPolicy()==true and eMemoryRessource::Host otherwise.

See also
memoryResource()
allocationOptions()
Precondition
!isNull()

Definition at line 350 of file RunQueue.cc.

◆ waitEvent() [1/2]

Blocks execution on the instance until the jobs recorded in event are finished.

Definition at line 266 of file RunQueue.cc.

◆ waitEvent() [2/2]

Blocks execution on the instance until the jobs recorded in event are finished.

Definition at line 256 of file RunQueue.cc.

◆ Impl::CudaUtils

friend class Impl::CudaUtils
friend

◆ Impl::HipUtils

friend class Impl::HipUtils
friend

◆ Impl::RunCommandLaunchInfo

friend class Impl::RunCommandLaunchInfo
friend

◆ Impl::SyclUtils

friend class Impl::SyclUtils
friend

◆ makeCommand [1/2]

RunCommand makeCommand ( const RunQueue & run_queue)
friend

Creates a command associated with the queue run_queue.

Definition at line 289 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.

◆ makeCommand [2/2]

RunCommand makeCommand ( const RunQueue * run_queue)
friend

Creates a command associated with the queue run_queue.

Definition at line 299 of file arccore/src/common/arccore/common/accelerator/RunQueue.h.

◆ NumArrayViewBase

friend class NumArrayViewBase
friend

◆ operator!=

bool operator!= ( const RunQueue & q1,
const RunQueue & q2 )
friend

◆ operator==

bool operator== ( const RunQueue & q1,
const RunQueue & q2 )
friend

◆ VariableViewBase

friend class VariableViewBase
friend

Member Data Documentation

◆ m_p

AutoRef2<Impl::RunQueueImpl> Arcane::Accelerator::RunQueue::m_p
private

◆ ProfileRegion

friend Arcane::Accelerator::RunQueue::ProfileRegion
private

◆ RunCommand

friend Arcane::Accelerator::RunQueue::RunCommand
private

◆ Runner

friend Arcane::Accelerator::RunQueue::Runner
private

◆ ViewBuildInfo

friend Arcane::Accelerator::RunQueue::ViewBuildInfo
private

The documentation for this class was generated from the following files: