Factory for tasks. More...
Static Public Member Functions | |
| template<typename InstanceType> | |
| static ITask * | createTask (InstanceType *instance, void(InstanceType::*function)(const TaskContext &tc)) |
| Creates a task. During execution, the task will call the method function via the instance instance. | |
| template<typename InstanceType> | |
| static ITask * | createTask (InstanceType *instance, void(InstanceType::*function)()) |
| Creates a task. During execution, the task will call the method function via the instance instance. | |
| template<typename InstanceType> | |
| static ITask * | createChildTask (ITask *parent_task, InstanceType *instance, void(InstanceType::*function)(const TaskContext &tc)) |
| Creates a child task. | |
| template<typename InstanceType> | |
| static ITask * | createChildTask (ITask *parent_task, InstanceType *instance, void(InstanceType::*function)()) |
| Creates a child task. | |
| static void | executeParallelFor (Integer begin, Integer size, const ParallelLoopOptions &options, IRangeFunctor *f) |
| Executes the functor f in parallel. | |
| static void | executeParallelFor (Integer begin, Integer size, Integer block_size, IRangeFunctor *f) |
| Executes the functor f in parallel. | |
| static void | executeParallelFor (Integer begin, Integer size, IRangeFunctor *f) |
| Executes the functor f in parallel. | |
| static void | executeParallelFor (const ParallelFor1DLoopInfo &loop_info) |
| Executes the loop loop_info in parallel. | |
| static void | executeParallelFor (const ComplexForLoopRanges< 1 > &loop_ranges, const ParallelLoopOptions &options, IMDRangeFunctor< 1 > *functor) |
| Executes a simple loop. | |
| static void | executeParallelFor (const ComplexForLoopRanges< 1 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 1 > *functor) |
| Executes a simple loop. | |
| static void | executeParallelFor (const ComplexForLoopRanges< 2 > &loop_ranges, const ParallelLoopOptions &options, IMDRangeFunctor< 2 > *functor) |
| Executes a 2D loop. | |
| static void | executeParallelFor (const ComplexForLoopRanges< 2 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 2 > *functor) |
| Executes a 2D loop. | |
| static void | executeParallelFor (const ComplexForLoopRanges< 3 > &loop_ranges, const ParallelLoopOptions &options, IMDRangeFunctor< 3 > *functor) |
| Executes a 3D loop. | |
| static void | executeParallelFor (const ComplexForLoopRanges< 3 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 3 > *functor) |
| Executes a 3D loop. | |
| static void | executeParallelFor (const ComplexForLoopRanges< 4 > &loop_ranges, const ParallelLoopOptions &options, IMDRangeFunctor< 4 > *functor) |
| Executes a 4D loop. | |
| static void | executeParallelFor (const ComplexForLoopRanges< 4 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 4 > *functor) |
| Executes a 4D loop. | |
| static Int32 | nbAllowedThread () |
| Maximum number of threads used to manage tasks. | |
| static Int32 | currentTaskThreadIndex () |
| Index (between 0 and nbAllowedThread()-1) of the thread executing the current task. | |
| static Int32 | currentTaskIndex () |
| Index (between 0 and nbAllowedThread()-1) of the current task. | |
| static void | setDefaultParallelLoopOptions (const ParallelLoopOptions &v) |
| Sets the default parallel loop execution options. | |
| static const ParallelLoopOptions & | defaultParallelLoopOptions () |
| Default parallel loop execution options. | |
| static bool | isActive () |
| Indicates whether tasks are active. Tasks are active if an implementation is available and if the requested number of threads is strictly greater than 1. | |
| static void | printInfos (std::ostream &o) |
| Prints information about the implementation. | |
| static IObservable * | createThreadObservable () |
| Observable called when a thread is created for a task. | |
| static IObservable * | destroyThreadObservable () |
| Observable called when a thread is destroyed for a task. | |
| static void | terminate () |
| Indicates that threads will no longer be used. This method must not be called when tasks are active. | |
| static void | setVerboseLevel (Integer v) |
| Sets the verbosity level (0 for no output, which is the default). | |
| static Integer | verboseLevel () |
| Verbosity level. | |
| static void | _internalSetImplementation (ITaskImplementation *task_impl) |
Private Attributes | |
| friend | TaskFactoryInternal |
Static Private Attributes | |
| static ITaskImplementation * | m_impl = &NullTaskImplementation::singleton |
| static Int32 | m_verbose_level = 0 |
Factory for tasks.
Definition at line 34 of file TaskFactory.h.
|
static |
Definition at line 235 of file ConcurrencyUtils.cc.
|
inlinestatic |
Creates a child task.
During execution, the task will call the method function via the instance instance.
Definition at line 89 of file TaskFactory.h.
References ARCCORE_CHECK_POINTER.
|
inlinestatic |
Creates a child task.
During execution, the task will call the method function via the instance instance.
Definition at line 75 of file TaskFactory.h.
References ARCCORE_CHECK_POINTER.
|
inlinestatic |
Creates a task. During execution, the task will call the method function via the instance instance.
Definition at line 62 of file TaskFactory.h.
|
inlinestatic |
Creates a task. During execution, the task will call the method function via the instance instance.
Definition at line 50 of file TaskFactory.h.
|
static |
Observable called when a thread is created for a task.
Definition at line 244 of file ConcurrencyUtils.cc.
|
inlinestatic |
Index (between 0 and nbAllowedThread()-1) of the current task.
This index is the same as currentTaskThreadIndex() except when we are in an executeParallelFor() with deterministic partitioning (ParallelLoopOptions::Partitioner::Deterministic). In the latter case, the task number is assigned deterministically, depending only on the number of threads allocated for the task and ParallelLoopOptions::grainSize().
If the current thread is not executing a task associated with this implementation, it returns (-1).
Definition at line 213 of file TaskFactory.h.
|
inlinestatic |
Index (between 0 and nbAllowedThread()-1) of the thread executing the current task.
For performance reasons, it is preferable to call this method as little as possible. Ideally, it should only be called at the beginning of the task execution and then the returned value should be used.
Definition at line 195 of file TaskFactory.h.
|
inlinestatic |
Default parallel loop execution options.
Definition at line 230 of file TaskFactory.h.
References Arcane::ConcurrencyBase::defaultParallelLoopOptions().
Referenced by Arcane::TBBTaskImplementation::_executeMDParallelFor(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::TBBTaskImplementation::executeParallelFor(), Arcane::TBBTaskImplementation::executeParallelFor(), and Arcane::TBBTaskImplementation::initialize().
|
static |
Observable called when a thread is destroyed for a task.
Definition at line 254 of file ConcurrencyUtils.cc.
|
inlinestatic |
Executes a simple loop.
Definition at line 129 of file TaskFactory.h.
|
inlinestatic |
Executes a simple loop.
Definition at line 121 of file TaskFactory.h.
|
inlinestatic |
Executes a 2D loop.
Definition at line 145 of file TaskFactory.h.
|
inlinestatic |
Executes a 2D loop.
Definition at line 137 of file TaskFactory.h.
|
inlinestatic |
Executes a 3D loop.
Definition at line 161 of file TaskFactory.h.
|
inlinestatic |
Executes a 3D loop.
Definition at line 153 of file TaskFactory.h.
|
inlinestatic |
Executes a 4D loop.
Definition at line 177 of file TaskFactory.h.
|
inlinestatic |
Executes a 4D loop.
Definition at line 169 of file TaskFactory.h.
|
inlinestatic |
Executes the loop loop_info in parallel.
Definition at line 115 of file TaskFactory.h.
|
inlinestatic |
Executes the functor f in parallel.
Definition at line 97 of file TaskFactory.h.
Referenced by Arcane::arcaneParallelFor(), Arcane::arcaneParallelFor(), Arcane::arcaneParallelFor(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForeach(), Arcane::arcaneParallelForVa(), Arcane::arccoreParallelFor(), Arcane::arccoreParallelFor(), Arcane::Parallel::For(), Arcane::Parallel::For(), Arcane::Parallel::For(), Arcane::Parallel::For(), Arcane::Parallel::For(), Arcane::Parallel::For(), Arcane::Parallel::Foreach(), Arcane::Parallel::Foreach(), Arcane::Parallel::Foreach(), and Arcane::Parallel::Foreach().
|
inlinestatic |
Executes the functor f in parallel.
Definition at line 103 of file TaskFactory.h.
|
inlinestatic |
Executes the functor f in parallel.
Definition at line 109 of file TaskFactory.h.
|
inlinestatic |
Indicates whether tasks are active. Tasks are active if an implementation is available and if the requested number of threads is strictly greater than 1.
Definition at line 242 of file TaskFactory.h.
Referenced by Arcane::Application::initialize().
|
inlinestatic |
Maximum number of threads used to manage tasks.
Definition at line 185 of file TaskFactory.h.
References Arcane::ConcurrencyBase::maxAllowedThread().
Referenced by Arcane::Application::initialize().
|
inlinestatic |
Prints information about the implementation.
The information is for example the version number or the name of the implementation.
Definition at line 253 of file TaskFactory.h.
Referenced by Arcane::Application::initialize().
|
inlinestatic |
Sets the default parallel loop execution options.
Definition at line 224 of file TaskFactory.h.
References Arcane::ConcurrencyBase::setDefaultParallelLoopOptions().
Referenced by Arcane::ArcaneLauncher::init(), and Arcane::TBBTaskImplementation::initialize().
|
inlinestatic |
Sets the verbosity level (0 for no output, which is the default).
Definition at line 290 of file TaskFactory.h.
References setVerboseLevel().
Referenced by setVerboseLevel().
|
static |
Indicates that threads will no longer be used. This method must not be called when tasks are active.
Definition at line 265 of file ConcurrencyUtils.cc.
Referenced by Arcane::Application::~Application().
|
inlinestatic |
Verbosity level.
Definition at line 293 of file TaskFactory.h.
Referenced by Arcane::TBBTaskImplementation::_executeMDParallelFor().
|
staticprivate |
Definition at line 304 of file TaskFactory.h.
|
staticprivate |
Definition at line 305 of file TaskFactory.h.
|
private |
Definition at line 36 of file TaskFactory.h.