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>
31adaptGrainSize(
const ForLoopRunInfo& run_info)
33 const std::optional<ParallelLoopOptions>& options = run_info.options();
34 Int32 grain_size = AbstractItemRangeFunctor::DEFAULT_GRAIN_SIZE;
35 if (options.has_value())
36 if (options.value().hasGrainSize())
37 grain_size = options.value().grainSize();
53template <
typename InstanceType,
typename ItemType>
inline void
57 Int32 grain_size = impl::adaptGrainSize(run_info);
63 adapted_run_info.addOptions(loop_opt);
76template <
typename LambdaType>
inline void
78 const LambdaType& lambda_function)
80 Int32 grain_size = impl::adaptGrainSize(run_info);
86 adapted_run_info.addOptions(loop_opt);
101template <
typename InstanceType,
typename ItemType>
inline void
114template <
typename InstanceType,
typename ItemType>
inline void
126template <
typename InstanceType,
typename ItemType>
inline void
138template <
typename InstanceType,
typename ItemType>
inline void
150template <
typename LambdaType>
inline void
152 const LambdaType& lambda_function)
162template <
typename LambdaType>
inline void
164 const LambdaType& lambda_function)
174template <
typename LambdaType>
inline void
185template <
typename LambdaType>
inline void
198template <
typename InstanceType>
inline void
212template <
typename LambdaType>
inline void
214 const LambdaType& lambda_function)
226template <
typename LambdaType>
inline void
228 const LambdaType& lambda_function)
237template <
typename LambdaType>
inline void
252template <
typename LambdaType,
typename... Views>
inline void
256 typename std::tuple_element_t<0, std::tuple<Views...>>
::size_type sizes[] = {views.size()...};
257 if (!std::all_of(std::begin(sizes), std::end(sizes),[&sizes](
auto cur){
return cur == sizes[0];}))
281 template <
typename InstanceType,
typename ItemType>
282 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
296 template <
typename InstanceType,
typename ItemType>
297 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
301 Foreach(items._paddedView(), options, instance, function);
307 template <
typename InstanceType,
typename ItemType>
308 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
318 template <
typename InstanceType,
typename ItemType>
319 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
322 Foreach(items._paddedView(), instance, function);
328 template <
typename LambdaType>
329 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
342 template <
typename LambdaType>
343 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
352 template <
typename LambdaType>
353 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
363 template <
typename LambdaType>
364 [[deprecated(
"Year2021: Use Arcane::arcaneParallelForeach() instead")]]
inline void
373 template <
typename InstanceType> ARCANE_DEPRECATED_122
inline void
384 template <
typename InstanceType>
385 [[deprecated(
"Year2021: Use Arcane::arcaneParallelFor() instead")]]
inline void
396 template <
typename LambdaType> ARCANE_DEPRECATED_122
inline void
406 template <
typename InstanceType>
407 [[deprecated(
"Year2021: Use Arcane::arcaneParallelFor() instead")]]
inline void
418 template <
typename LambdaType>
419 [[deprecated(
"Year2021: Use Arcane::arcaneParallelFor() instead")]]
inline void
429 template <
typename LambdaType>
430 [[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.