Arcane  v4.1.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ConcurrencyUtils.h
Aller à la documentation de ce fichier.
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* ConcurrencyUtils.h (C) 2000-2025 */
9/* */
10/* Classes gérant la concurrence (tâches, boucles parallèles, ...) */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_CONCURRENCYUTILS_H
13#define ARCANE_UTILS_CONCURRENCYUTILS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19#include "arccore/concurrency/ParallelFor.h"
20#include "arccore/concurrency/TaskFactory.h"
21#include "arccore/concurrency/ITaskImplementation.h"
22#include "arccore/concurrency/Task.h"
23#include "arccore/concurrency/ForLoopRunInfo.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
37template<int RankValue,typename LambdaType,typename... ReducerArgs> inline void
39 const ForLoopRunInfo& run_info,
40 const LambdaType& lambda_function,
41 const ReducerArgs&... reducer_args)
42{
43 arccoreParallelFor(loop_ranges,run_info,lambda_function,reducer_args...);
44}
45
46/*---------------------------------------------------------------------------*/
47/*---------------------------------------------------------------------------*/
52template<int RankValue,typename LambdaType,typename... ReducerArgs> inline void
54 const ParallelLoopOptions& options,
55 const LambdaType& lambda_function,
56 const ReducerArgs&... reducer_args)
57{
58 arccoreParallelFor(loop_ranges,ForLoopRunInfo(options),lambda_function,reducer_args...);
59}
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
67template <int RankValue, typename LambdaType, typename... ReducerArgs> inline void
69 const ForLoopRunInfo& run_info,
70 const LambdaType& lambda_function,
71 const ReducerArgs&... reducer_args)
72{
73 arccoreParallelFor(loop_ranges,run_info,lambda_function,reducer_args...);
74}
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
82template <int RankValue, typename LambdaType, typename... ReducerArgs> inline void
84 const ParallelLoopOptions& options,
85 const LambdaType& lambda_function,
86 const ReducerArgs&... reducer_args)
87{
88 arccoreParallelFor(loop_ranges,options,lambda_function,reducer_args...);
89}
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
97template<int RankValue,typename LambdaType> inline void
99 const LambdaType& lambda_function)
100{
101 arccoreParallelFor(loop_ranges,lambda_function);
102}
103
104/*---------------------------------------------------------------------------*/
105/*---------------------------------------------------------------------------*/
110template<int RankValue,typename LambdaType> inline void
112 const LambdaType& lambda_function)
113{
114 arccoreParallelFor(loop_ranges,lambda_function);
115}
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
119
120} // End namespace Arcane
121
122/*---------------------------------------------------------------------------*/
123/*---------------------------------------------------------------------------*/
124
125#endif
Déclarations des types utilisés dans Arcane.
Informations d'exécution d'une boucle.
Options d'exécution d'une boucle parallèle en multi-thread.
void arcaneParallelFor(Integer i0, Integer size, InstanceType *itype, void(InstanceType::*lambda_function)(Integer i0, Integer size))
Applique en concurrence la fonction lambda lambda_function sur l'intervalle d'itération [i0,...
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
void arccoreParallelFor(const ComplexForLoopRanges< RankValue > &loop_ranges, const ForLoopRunInfo &run_info, const LambdaType &lambda_function, const ReducerArgs &... reducer_args)
Applique en concurrence la fonction lambda lambda_function sur l'intervalle d'itération donné par loo...
Definition ParallelFor.h:85