Arcane  4.2.3.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
StandaloneAcceleratorMng.cc
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/* StandaloneStandaloneAcceleratorMng.cc (C) 2000-2026 */
9/* */
10/* Implémentation autonome (sans IApplication) de 'IAcceleratorMng.h'. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/launcher/StandaloneAcceleratorMng.h"
15
16#include "arccore/concurrency/internal/ConcurrencyApplication.h"
17
18#include "arcane/utils/Ref.h"
19#include "arcane/utils/ITraceMng.h"
20
21#include "arcane/impl/MainFactory.h"
22#include "arcane/impl/ArcaneMain.h"
23
24#include "arcane/accelerator/core/IAcceleratorMng.h"
25
26#include "arcane/AcceleratorRuntimeInitialisationInfo.h"
27
28#include "arcane/launcher/ArcaneLauncher.h"
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33namespace Arcane
34{
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
39namespace
40{
42 _stringListToCoreArray(const StringList& slist)
43 {
45 for (const String& s : slist)
46 a.add(s);
47 return a;
48 }
49} // namespace
50
51/*---------------------------------------------------------------------------*/
52/*---------------------------------------------------------------------------*/
53
55{
56 public:
57 Impl()
58 {
59 MainFactory main_factory;
60 m_trace_mng = main_factory.createTraceMng();
61 m_accelerator_mng = main_factory.createAcceleratorMngRef(m_trace_mng.get());
62
65
66 const CommandLineArguments& cmd_line_args = app_info.commandLineArguments();
67 app_build_info.parseArgumentsAndSetDefaultsValues(cmd_line_args);
68 app_build_info.setDefaultServices();
69
70 {
71 m_concurrency_application.setTraceMng(m_trace_mng);
72 auto task_names = _stringListToCoreArray(app_build_info.taskImplementationServices());
73 auto thread_names = _stringListToCoreArray(app_build_info.threadImplementationServices());
74 ConcurrencyApplicationBuildInfo c(task_names.constView(), thread_names.constView(), app_build_info.nbTaskThread());
75 m_concurrency_application.setCoreServices(c);
76 }
77 }
78 public:
80 Ref<IAcceleratorMng> m_accelerator_mng;
81 ConcurrencyApplication m_concurrency_application;
82};
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87StandaloneAcceleratorMng::
88StandaloneAcceleratorMng()
89: m_p(makeRef(new Impl()))
90{
91 m_p->m_accelerator_mng->initialize(ArcaneLauncher::acceleratorRuntimeInitialisationInfo());
92}
93
94/*---------------------------------------------------------------------------*/
95/*---------------------------------------------------------------------------*/
96
98traceMng() const
99{
100 return m_p->m_trace_mng.get();
101}
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
107acceleratorMng() const
108{
109 return m_p->m_accelerator_mng.get();
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115} // End namespace Arcane
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
Informations pour construire une instance de IApplication.
Informations sur une application.
const CommandLineArguments & commandLineArguments() const
Arguments de la ligne de commande.
static AcceleratorRuntimeInitialisationInfo & acceleratorRuntimeInitialisationInfo()
Informations pour l'initialisation des accélerateurs.
static ApplicationBuildInfo & defaultApplicationBuildInfo()
Informations pour l'initialisation des accélerateurs.
static ApplicationInfo & defaultApplicationInfo()
Infos par défaut de l'application.
void parseArgumentsAndSetDefaultsValues(const CommandLineArguments &args)
Analyse les arguments de args.
Interface du gestionnaire de traces.
Manufacture des classes d'Arcane.
Definition MainFactory.h:53
ITraceMng * createTraceMng() override
Créé un gestionnaire de trace.
Ref< IAcceleratorMng > createAcceleratorMngRef(ITraceMng *tm) override
Créé un gestionnaire pour les accélérateurs.
Référence à une instance.
Encapsulation d'un pointeur avec compteur de référence.
ITraceMng * traceMng() const
Gestionnaire de trace associé.
IAcceleratorMng * acceleratorMng() const
Gestionnaire des accélérateurs associé.
Chaîne de caractères unicode.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
List< String > StringList
Tableau de chaînes de caractères unicode.
Definition UtilsTypes.h:507
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Créé une référence sur un pointeur.