12#ifndef ARCANE_CORE_CONCURRENCY_H
13#define ARCANE_CORE_CONCURRENCY_H
19#include "arcane/core/Item.h"
20#include "arcane/core/ItemFunctor.h"
21#include "arcane/core/ItemGroup.h"
23#include "arcane/core/materials/MatItem.h"
33adaptGrainSize(
const ForLoopRunInfo& run_info)
35 const std::optional<ParallelLoopOptions>& options = run_info.options();
36 Int32 grain_size = AbstractItemRangeFunctor::DEFAULT_GRAIN_SIZE;
37 if (options.has_value())
38 if (options.value().hasGrainSize())
39 grain_size = options.value().grainSize();
55template <
typename InstanceType,
typename ItemType>
inline void
59 Int32 grain_size = impl::adaptGrainSize(run_info);
65 adapted_run_info.addOptions(loop_opt);
78template <
typename LambdaType>
inline void
80 const LambdaType& lambda_function)
82 Int32 grain_size = impl::adaptGrainSize(run_info);
88 adapted_run_info.addOptions(loop_opt);
103template <
typename InstanceType,
typename ItemType>
inline void
116template <
typename InstanceType,
typename ItemType>
inline void
128template <
typename InstanceType,
typename ItemType>
inline void
140template <
typename InstanceType,
typename ItemType>
inline void
152template <
typename LambdaType>
inline void
154 const LambdaType& lambda_function)
164template <
typename LambdaType>
inline void
166 const LambdaType& lambda_function)
176template <
typename LambdaType>
inline void
187template <
typename LambdaType>
inline void
200template <
typename InstanceType>
inline void
214template <
typename LambdaType>
inline void
216 const LambdaType& lambda_function)
228template <
typename LambdaType>
inline void
230 const LambdaType& lambda_function)
239template <
typename LambdaType>
inline void
254template <
typename LambdaType,
typename... Views>
inline void
258 typename std::tuple_element_t<0, std::tuple<Views...>>
::size_type sizes[] = {views.size()...};
259 if (!std::all_of(std::begin(sizes), std::end(sizes),[&sizes](
auto cur){
return cur == sizes[0];}))
283 template <
typename InstanceType,
typename ItemType>
284 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
298 template <
typename InstanceType,
typename ItemType>
299 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
303 Foreach(items._paddedView(), options, instance, function);
309 template <
typename InstanceType,
typename ItemType>
310 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
320 template <
typename InstanceType,
typename ItemType>
321 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
324 Foreach(items._paddedView(), instance, function);
330 template <
typename LambdaType>
331 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
344 template <
typename LambdaType>
345 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
354 template <
typename LambdaType>
355 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
365 template <
typename LambdaType>
366 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
375 template <
typename InstanceType> ARCANE_DEPRECATED_122
inline void
386 template <
typename InstanceType>
387 [[deprecated(
"Year2021: Use Arcane::arcaneParallelFor() instead")]]
inline void
398 template <
typename LambdaType> ARCANE_DEPRECATED_122
inline void
408 template <
typename InstanceType>
409 [[deprecated(
"Year2021: Use Arcane::arcaneParallelFor() instead")]]
inline void
420 template <
typename LambdaType>
421 [[deprecated(
"Year2021: Use Arcane::arcaneParallelFor() instead")]]
inline void
431 template <
typename LambdaType>
432 [[deprecated(
"Year2021: Use Arcane::arcaneParallelFor() instead")]]
inline void
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Classes, Types et macros pour gérer la concurrence.
Int32 nbBlock() const
Nombre de blocs.
Int32 blockGrainSize() const
Taille souhaitée d'un intervalle d'itération.
Informations d'exécution d'une boucle.
Groupe d'entités de maillage.
ItemVectorView _paddedView() const
Vue sur les entités du groupe avec padding pour la vectorisation.
Fonctor pour itérer sur une liste d'entités.
Vue sur un tableau typé d'entités.
Vue sur un vecteur d'entités.
Fonctor sur un interval d'itération instancié via une lambda fonction.
Fonctor sur un interval d'itération instancié via une lambda fonction.
Fonctor sur un interval d'itération instancié via une lambda fonction.
Caractéristiques d'un boucle 1D multi-thread.
Options d'exécution d'une boucle parallèle en multi-thread.
Integer grainSize() const
Taille d'un intervalle d'itération.
void setGrainSize(Integer v)
Positionne la taille (approximative) d'un intervalle d'itération.
Fonctor sur un interval d'itération.
static const ParallelLoopOptions & defaultParallelLoopOptions()
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.
void arcaneParallelForeach(const ItemVectorView &items_view, const ForLoopRunInfo &run_info, InstanceType *instance, void(InstanceType::*function)(ItemVectorViewT< ItemType > items))
Applique en concurrence la méthode function de l'instance instance sur la vue items_view avec les opt...
void arcaneParallelForVa(const ForLoopRunInfo &run_info, const LambdaType &lambda_function, Views... views)
Applique en concurrence la fonction lambda lambda_function instance sur les vues des containers views...
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,...
Implémentation de la concurrence.
void Foreach(const ItemVectorView &items_view, const ParallelLoopOptions &options, InstanceType *instance, void(InstanceType::*function)(ItemVectorViewT< ItemType > items))
ARCANE_DEPRECATED_122 void For(Integer i0, Integer size, Integer grain_size, InstanceType *itype, void(InstanceType::*lambda_function)(Integer i0, Integer size))
-*- 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.