Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ITaskImplementation.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ITaskImplementation.h (C) 2000-2025 */
9/* */
10/* Task management interface. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_BASE_ITASKIMPLEMENTATION_H
13#define ARCCORE_BASE_ITASKIMPLEMENTATION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/concurrency/ConcurrencyGlobal.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
37class ARCCORE_CONCURRENCY_EXPORT ITaskImplementation
38{
39 public:
40
41 virtual ~ITaskImplementation() = default;
42
43 public:
44
53 virtual void initialize(Int32 nb_thread) = 0;
59 virtual void terminate() = 0;
66
68 virtual void executeParallelFor(Integer begin, Integer size, const ParallelLoopOptions& options, IRangeFunctor* f) = 0;
69
71 virtual void executeParallelFor(Integer begin, Integer size, Integer block_size, IRangeFunctor* f) = 0;
72
74 virtual void executeParallelFor(Integer begin, Integer size, IRangeFunctor* f) = 0;
75
77 virtual void executeParallelFor(const ParallelFor1DLoopInfo& loop_info) = 0;
78
80 virtual void executeParallelFor(const ComplexForLoopRanges<1>& loop_ranges,
81 const ForLoopRunInfo& run_info,
82 IMDRangeFunctor<1>* functor) = 0;
84 virtual void executeParallelFor(const ComplexForLoopRanges<2>& loop_ranges,
85 const ForLoopRunInfo& run_info,
86 IMDRangeFunctor<2>* functor) = 0;
88 virtual void executeParallelFor(const ComplexForLoopRanges<3>& loop_ranges,
89 const ForLoopRunInfo& run_info,
90 IMDRangeFunctor<3>* functor) = 0;
92 virtual void executeParallelFor(const ComplexForLoopRanges<4>& loop_ranges,
93 const ForLoopRunInfo& run_info,
94 IMDRangeFunctor<4>* functor) = 0;
95
97 virtual bool isActive() const = 0;
98
100 ARCCORE_DEPRECATED_REASON("Y2025: use ConcurrencyBase::maxAllowedThread() instead")
101 Int32 nbAllowedThread() const;
102
104 virtual Int32 currentTaskThreadIndex() const = 0;
105
107 virtual Int32 currentTaskIndex() const = 0;
108
110 virtual void printInfos(std::ostream& o) const = 0;
111};
112
113/*---------------------------------------------------------------------------*/
114/*---------------------------------------------------------------------------*/
115
116} // End namespace Arcane
117
118/*---------------------------------------------------------------------------*/
119/*---------------------------------------------------------------------------*/
120
121#endif
Loop execution information.
Interface of a functor on a multi-dimensional iteration interval of dimension RankValue.
Interface of a functor on an iteration interval.
Interface for a task functor.
Definition Task.h:76
Implementation of a task factory.
virtual void executeParallelFor(Integer begin, Integer size, const ParallelLoopOptions &options, IRangeFunctor *f)=0
Executes the functor f in parallel.
virtual void executeParallelFor(Integer begin, Integer size, IRangeFunctor *f)=0
Executes the functor f in parallel.
virtual void executeParallelFor(const ParallelFor1DLoopInfo &loop_info)=0
Executes the loop loop_info in parallel.
Int32 nbAllowedThread() const
Maximum number of threads used to manage tasks.
virtual void executeParallelFor(const ComplexForLoopRanges< 2 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 2 > *functor)=0
Executes a 2D loop in parallel.
virtual void executeParallelFor(Integer begin, Integer size, Integer block_size, IRangeFunctor *f)=0
Executes the functor f in parallel.
virtual void executeParallelFor(const ComplexForLoopRanges< 3 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 3 > *functor)=0
Executes a 3D loop in parallel.
virtual ITask * createRootTask(ITaskFunctor *f)=0
Creates a root task. The implementation must copy the value of f, which is either a TaskFunctor or a ...
virtual Int32 currentTaskIndex() const =0
Implementation of TaskFactory::currentTaskIndex().
virtual bool isActive() const =0
Indicates if the implementation is active.
virtual void executeParallelFor(const ComplexForLoopRanges< 4 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 4 > *functor)=0
Executes a 4D loop in parallel.
virtual void executeParallelFor(const ComplexForLoopRanges< 1 > &loop_ranges, const ForLoopRunInfo &run_info, IMDRangeFunctor< 1 > *functor)=0
Executes a 1D loop in parallel.
virtual void printInfos(std::ostream &o) const =0
Prints information about the runtime used.
virtual void terminate()=0
virtual Int32 currentTaskThreadIndex() const =0
Implementation of TaskFactory::currentTaskThreadIndex().
virtual void initialize(Int32 nb_thread)=0
Interface for a concurrent task.
Definition Task.h:194
Characteristics of a multi-thread 1D loop.
Definition ParallelFor.h:35
Execution options for a parallel loop in multi-threading.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
std::int32_t Int32
Signed integer type of 32 bits.