Arcane  v3.16.0.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
core/RunCommand.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* RunCommand.h (C) 2000-2024 */
9/* */
10/* Gestion d'une commande sur accélérateur. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_ACCELERATOR_CORE_RUNCOMMAND_H
13#define ARCANE_ACCELERATOR_CORE_RUNCOMMAND_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane::Accelerator
23{
24namespace impl
25{
26extern "C++" ARCANE_ACCELERATOR_CORE_EXPORT IReduceMemoryImpl*
27internalGetOrCreateReduceMemoryImpl(RunCommand* command);
28}
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32/*!
33 * \brief Gestion d'une commande sur accélérateur.
34 *
35 * Une commande est associée à une file d'exécution (RunQueue) et sa durée
36 * de vie ne doit pas excéder celle de cette dernière.
37 *
38 * \warning API en cours de définition.
39 */
40class ARCANE_ACCELERATOR_CORE_EXPORT RunCommand
41{
42 friend impl::IReduceMemoryImpl* impl::internalGetOrCreateReduceMemoryImpl(RunCommand* command);
44 friend impl::RunQueueImpl;
45 friend class ViewBuildInfo;
46
47 friend RunCommand makeCommand(const RunQueue& run_queue);
48 friend RunCommand makeCommand(const RunQueue* run_queue);
49
50 public:
51
52 ~RunCommand();
53
54 protected:
55
56 explicit RunCommand(const RunQueue& run_queue);
57
58 public:
59
60 RunCommand(RunCommand&& command) = delete;
61 RunCommand(const RunCommand&) = delete;
62 RunCommand& operator=(const RunCommand&) = delete;
63 RunCommand& operator=(RunCommand&&) = delete;
64
65 public:
66
67 /*!
68 * \brief Positionne le informations de trace.
69 *
70 * Ces informations sont utilisées pour les traces ou pour le débug.
71 * Les macros RUNCOMMAND_LOOP ou RUNCOMMAND_ENUMERATE appellent
72 * automatiquement cette méthode.
73 */
74 RunCommand& addTraceInfo(const TraceInfo& ti);
75
76 /*!
77 * \brief Positionne le nom du noyau.
78 *
79 * Ce nom est utilisé pour les traces ou pour le débug.
80 */
81 RunCommand& addKernelName(const String& v);
82
83 /*!
84 * \brief Positionne le nombre de thread par bloc pour les accélérateurs.
85 *
86 * Si la valeur \a v est nulle, le choix par défaut est utilisé.
87 * Si la valeur \a v est positive, sa valeur minimale valide dépend
88 * de l'accélérateur. En général c'est au moins 32.
89 */
90 RunCommand& addNbThreadPerBlock(Int32 v);
91
92 //! Informations pour les traces
93 const TraceInfo& traceInfo() const;
94
95 //! Nom du noyau
96 const String& kernelName() const;
97
98 /*
99 * \brief Nombre de threads par bloc ou 0 pour la valeur par défaut.
100 *
101 * Cette valeur est utilisée uniquement si on s'exécute sur accélérateur.
102 */
103 Int32 nbThreadPerBlock() const;
104
105 //! Positionne la configuration des boucles multi-thread
107
108 //! Configuration des boucles multi-thread
110
111 //! Affichage des informations de la commande
112 friend ARCANE_ACCELERATOR_CORE_EXPORT RunCommand&
113 operator<<(RunCommand& command, const TraceInfo& trace_info);
114
115 private:
116
117 // Pour RunCommandLaunchInfo
118 void _internalNotifyBeginLaunchKernel();
119 void _internalNotifyEndLaunchKernel();
120 void _internalNotifyBeginLaunchKernelSyclEvent(void* sycl_event_ptr);
121 ForLoopOneExecStat* _internalCommandExecStat();
122
123 private:
124
125 //! \internal
126 impl::RunQueueImpl* _internalQueueImpl() const;
127 impl::NativeStream _internalNativeStream() const;
128 static impl::RunCommandImpl* _internalCreateImpl(impl::RunQueueImpl* queue);
129 static void _internalDestroyImpl(impl::RunCommandImpl* p);
130
131 private:
132
133 void _allocateReduceMemory(Int32 nb_grid);
134
135 private:
136
137 impl::RunCommandImpl* m_p;
138};
139
140/*---------------------------------------------------------------------------*/
141/*---------------------------------------------------------------------------*/
142
143} // End namespace Arcane::Accelerator
144
145/*---------------------------------------------------------------------------*/
146/*---------------------------------------------------------------------------*/
147
148#endif
const ParallelLoopOptions & parallelLoopOptions() const
Configuration des boucles multi-thread.
friend RunCommand makeCommand(const RunQueue &run_queue)
Créé une commande associée à la file run_queue.
void setParallelLoopOptions(const ParallelLoopOptions &opt)
Positionne la configuration des boucles multi-thread.
friend RunCommand & operator<<(RunCommand &command, const TraceInfo &trace_info)
Affichage des informations de la commande.
RunCommand & addNbThreadPerBlock(Int32 v)
Positionne le nombre de thread par bloc pour les accélérateurs.
RunCommand & addKernelName(const String &v)
Positionne le nom du noyau.
Definition RunCommand.cc:93
RunCommand & addTraceInfo(const TraceInfo &ti)
Positionne le informations de trace.
Definition RunCommand.cc:83
const TraceInfo & traceInfo() const
Informations pour les traces.
Definition RunCommand.cc:56
const String & kernelName() const
Nom du noyau.
Definition RunCommand.cc:65
File d'exécution pour un accélérateur.
Type opaque pour encapsuler une 'stream' native.
Classe pour gérer le profiling d'une seule exécution d'une boucle.
Definition Profiling.h:93
Options d'exécution d'une boucle parallèle en multi-thread.
Chaîne de caractères unicode.
Espace de nom pour l'utilisation des accélérateurs.
std::int32_t Int32
Type entier signé sur 32 bits.