12#ifndef ARCCORE_BASE_TASKFACTORY_H
13#define ARCCORE_BASE_TASKFACTORY_H
17#include "arccore/concurrency/Task.h"
18#include "arccore/concurrency/ITaskImplementation.h"
32class ARCCORE_CONCURRENCY_EXPORT TaskFactory
34 friend TaskFactoryInternal;
38 TaskFactory() =
delete;
47 template <
typename InstanceType>
static ITask*
51 return m_impl->createRootTask(&functor);
59 template <
typename InstanceType>
static ITask*
60 createTask(InstanceType* instance,
void (InstanceType::*function)())
63 return m_impl->createRootTask(&functor);
72 template <
typename InstanceType>
static ITask*
75 ARCCORE_CHECK_POINTER(parent_task);
77 return parent_task->_createChildTask(&functor);
86 template <
typename InstanceType>
static ITask*
89 ARCCORE_CHECK_POINTER(parent_task);
91 return parent_task->_createChildTask(&functor);
97 m_impl->executeParallelFor(begin, size, options, f);
103 m_impl->executeParallelFor(begin, size, block_size, f);
109 m_impl->executeParallelFor(begin, size, f);
115 m_impl->executeParallelFor(loop_info);
123 m_impl->executeParallelFor(loop_ranges,
ForLoopRunInfo(options), functor);
131 m_impl->executeParallelFor(loop_ranges, run_info, functor);
139 m_impl->executeParallelFor(loop_ranges,
ForLoopRunInfo(options), functor);
147 m_impl->executeParallelFor(loop_ranges, run_info, functor);
155 m_impl->executeParallelFor(loop_ranges,
ForLoopRunInfo(options), functor);
163 m_impl->executeParallelFor(loop_ranges, run_info, functor);
171 m_impl->executeParallelFor(loop_ranges,
ForLoopRunInfo(options), functor);
179 m_impl->executeParallelFor(loop_ranges, run_info, functor);
185 return m_impl->nbAllowedThread();
197 return m_impl->currentTaskThreadIndex();
215 return m_impl->currentTaskIndex();
223 m_default_loop_options = v;
229 return m_default_loop_options;
241 return m_impl->isActive();
252 return m_impl->printInfos(o);
263 ARCCORE_DEPRECATED_REASON(
"Y2024: This method is internal to Arcane. Do not use it")
274 ARCCORE_DEPRECATED_REASON(
"Y2024: This method is internal to Arcane. Do not use it")
282 static
void terminate();
295 ARCCORE_DEPRECATED_REASON(
"Y2024: This method is internal to Arcane. "
296 "Use TaskFactoryInternal::setImplementation() instead")
302 static
Int32 m_verbose_level;
Informations d'exécution d'une boucle.
Interface d'un fonctor sur un interval d'itération multi-dimensionnel de dimension RankValue.
Interface d'un observable.
Interface d'un fonctor sur un interval d'itération.
Interface d'une tâche concourante.
Caractéristiques d'un boucle 1D multi-thread.
Options d'exécution d'une boucle parallèle en multi-thread.
Contexte d'éxecution d'une tâche.
static Int32 currentTaskIndex()
Indice (entre 0 et nbAllowedThread()-1) de la tâche actuelle.
static void executeParallelFor(const ParallelFor1DLoopInfo &loop_info)
Exécute la boucle loop_info en concurrence.
static void setVerboseLevel(Integer v)
Positionne le niveau de verbosité (0 pour pas d'affichage qui est le défaut)
static Int32 nbAllowedThread()
Nombre de threads utilisés au maximum pour gérer les tâches.
static void executeParallelFor(Integer begin, Integer size, IRangeFunctor *f)
Exécute le fonctor f en concurrence.
static ITask * createTask(InstanceType *instance, void(InstanceType::*function)())
Créé une tâche. Lors de l'exécution, la tâche appellera la méthode function via l'instance instance.
static const ParallelLoopOptions & defaultParallelLoopOptions()
Valeurs par défaut d'exécution d'une boucle parallèle.
static void executeParallelFor(const ComplexForLoopRanges< 1 > &loop_ranges, const ParallelLoopOptions &options, IMDRangeFunctor< 1 > *functor)
Exécute une boucle simple.
static void executeParallelFor(const ComplexForLoopRanges< 1 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 1 > *functor)
Exécute une boucle simple.
static void executeParallelFor(const ComplexForLoopRanges< 2 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 2 > *functor)
Exécute une boucle 2D.
static Integer verboseLevel()
Niveau de verbosité
static void executeParallelFor(const ComplexForLoopRanges< 4 > &loop_ranges, const ParallelLoopOptions &options, IMDRangeFunctor< 4 > *functor)
Exécute une boucle 4D.
static void executeParallelFor(const ComplexForLoopRanges< 2 > &loop_ranges, const ParallelLoopOptions &options, IMDRangeFunctor< 2 > *functor)
Exécute une boucle 2D.
static void setDefaultParallelLoopOptions(const ParallelLoopOptions &v)
Positionne les valeurs par défaut d'exécution d'une boucle parallèle.
static void executeParallelFor(Integer begin, Integer size, const ParallelLoopOptions &options, IRangeFunctor *f)
Exécute le fonctor f en concurrence.
static void executeParallelFor(Integer begin, Integer size, Integer block_size, IRangeFunctor *f)
Exécute le fonctor f en concurrence.
static void executeParallelFor(const ComplexForLoopRanges< 3 > &loop_ranges, const ParallelLoopOptions &options, IMDRangeFunctor< 3 > *functor)
Exécute une boucle 3D.
static ITask * createChildTask(ITask *parent_task, InstanceType *instance, void(InstanceType::*function)(const TaskContext &tc))
Créé une tâche fille.
static Int32 currentTaskThreadIndex()
Indice (entre 0 et nbAllowedThread()-1) du thread exécutant la tâche actuelle.
static ITask * createChildTask(ITask *parent_task, InstanceType *instance, void(InstanceType::*function)())
Créé une tâche fille.
static bool isActive()
Indique si les tâches sont actives. Les tâches sont actives si une implémentation est disponible et s...
static ITask * createTask(InstanceType *instance, void(InstanceType::*function)(const TaskContext &tc))
Créé une tâche. Lors de l'exécution, la tâche appellera la méthode function via l'instance instance.
static void executeParallelFor(const ComplexForLoopRanges< 4 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 4 > *functor)
Exécute une boucle 4D.
static void printInfos(std::ostream &o)
Affiche les informations sur l'implémentation.
static void executeParallelFor(const ComplexForLoopRanges< 3 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 3 > *functor)
Exécute une boucle 3D.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.
std::int32_t Int32
Type entier signé sur 32 bits.