Arcane  4.2.2.0
User documentation
Loading...
Searching...
No Matches
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/* Standalone implementation (without IApplication) of '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
58 Impl()
59 {
60 MainFactory main_factory;
61 m_trace_mng = main_factory.createTraceMng();
62 m_accelerator_mng = main_factory.createAcceleratorMngRef(m_trace_mng.get());
63
64 const ApplicationInfo& app_info = ArcaneMain::defaultApplicationInfo();
65 ApplicationBuildInfo& app_build_info = ArcaneMain::defaultApplicationBuildInfo();
66
67 const CommandLineArguments& cmd_line_args = app_info.commandLineArguments();
68 app_build_info.parseArgumentsAndSetDefaultsValues(cmd_line_args);
69 app_build_info.setDefaultServices();
70
71 {
72 m_concurrency_application.setTraceMng(m_trace_mng);
73 auto task_names = _stringListToCoreArray(app_build_info.taskImplementationServices());
74 auto thread_names = _stringListToCoreArray(app_build_info.threadImplementationServices());
75 ConcurrencyApplicationBuildInfo c(task_names.constView(), thread_names.constView(), app_build_info.nbTaskThread());
76 m_concurrency_application.setCoreServices(c);
77 }
78 }
79
80 public:
81
83 Ref<IAcceleratorMng> m_accelerator_mng;
84 ConcurrencyApplication m_concurrency_application;
85};
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
90StandaloneAcceleratorMng::
91StandaloneAcceleratorMng()
92: m_p(makeRef(new Impl()))
93{
94 m_p->m_accelerator_mng->initialize(ArcaneLauncher::acceleratorRuntimeInitialisationInfo());
95}
96
97/*---------------------------------------------------------------------------*/
98/*---------------------------------------------------------------------------*/
99
101traceMng() const
102{
103 return m_p->m_trace_mng.get();
104}
105
106/*---------------------------------------------------------------------------*/
107/*---------------------------------------------------------------------------*/
108
110acceleratorMng() const
111{
112 return m_p->m_accelerator_mng.get();
113}
114
115/*---------------------------------------------------------------------------*/
116/*---------------------------------------------------------------------------*/
117
118} // End namespace Arcane
119
120/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
Information for constructing an instance of IApplication.
Application information.
const CommandLineArguments & commandLineArguments() const
Command line arguments.
static AcceleratorRuntimeInitialisationInfo & acceleratorRuntimeInitialisationInfo()
Information for accelerator initialization.
void parseArgumentsAndSetDefaultsValues(const CommandLineArguments &args)
Parses the arguments in args.
Reference to an instance.
Encapsulation of a pointer with a reference counter.
ITraceMng * traceMng() const
Associated trace manager.
IAcceleratorMng * acceleratorMng() const
Associated accelerator manager.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
List< String > StringList
Unicode string list.
Definition UtilsTypes.h:503
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.