14#include "arcane/core/ApplicationBuildInfo.h"
16#include "arcane/utils/PlatformUtils.h"
17#include "arcane/utils/String.h"
18#include "arcane/utils/List.h"
19#include "arcane/utils/CommandLineArguments.h"
20#include "arcane/utils/TraceClassConfig.h"
21#include "arcane/utils/ApplicationInfo.h"
23#include "arcane/core/CaseDatasetSource.h"
25#include "arccore/common/internal/FieldProperty.h"
42 x = std::min(std::max(x,min_value),max_value);
56 : m_nb_task_thread(-1)
59 m_nb_task_thread.setValidator([](
Int32& x) { _clamp(x, -1, 512); });
65 const String& default_value)
67 return m_property_key_values.getValue(env_values, param_name, default_value);
69 void addKeyValue(
const String& name,
const String& value)
71 m_property_key_values.add(name, value);
76 FieldProperty<StringList> m_task_implementation_services;
77 FieldProperty<StringList> m_thread_implementation_services;
78 FieldProperty<Int32> m_nb_task_thread;
95 : m_nb_shared_memory_sub_domain(0)
96 , m_nb_replication_sub_domain(0)
97 , m_nb_processus_sub_domain(0)
98 , m_config_file_name(
"")
103 m_nb_shared_memory_sub_domain.setValidator([](
Int32& x){ _clamp(x,0,1024); });
104 m_nb_replication_sub_domain.setValidator([](
Int32& x){ x = std::max(x,0); });
105 m_nb_processus_sub_domain.setValidator([](
Int32& x){ x = std::max(x,0); });
113 FieldProperty<String> m_message_passing_service;
114 FieldProperty<Int32> m_nb_shared_memory_sub_domain;
115 FieldProperty<Int32> m_nb_replication_sub_domain;
116 FieldProperty<Int32> m_nb_processus_sub_domain;
117 FieldProperty<String> m_config_file_name;
118 FieldProperty<Int32> m_output_level;
119 FieldProperty<Int32> m_verbosity_level;
120 FieldProperty<Int32> m_minimal_verbosity_level;
121 FieldProperty<bool> m_is_master_has_output_file;
122 FieldProperty<String> m_output_directory;
123 FieldProperty<String> m_thread_binding_strategy;
126 String m_default_message_passing_service;
133ApplicationCoreBuildInfo::
134ApplicationCoreBuildInfo()
139ApplicationCoreBuildInfo::
141: m_core(new CoreImpl(*rhs.m_core))
145ApplicationCoreBuildInfo& ApplicationCoreBuildInfo::
146operator=(
const ApplicationCoreBuildInfo& rhs)
150 m_core =
new CoreImpl(*(rhs.m_core));
155ApplicationCoreBuildInfo::
156~ApplicationCoreBuildInfo()
164ApplicationBuildInfo::
165ApplicationBuildInfo()
173ApplicationBuildInfo::
174ApplicationBuildInfo(
const ApplicationBuildInfo& rhs)
175: ApplicationCoreBuildInfo(rhs)
176, m_p(new
Impl(*rhs.m_p))
180ApplicationBuildInfo& ApplicationBuildInfo::
181operator=(
const ApplicationBuildInfo& rhs)
183 ApplicationCoreBuildInfo::operator=(rhs);
186 m_p =
new Impl(*(rhs.m_p));
194ApplicationBuildInfo::
195~ApplicationBuildInfo()
203void ApplicationCoreBuildInfo::
207 String str = m_core->getValue({
"ARCANE_NB_TASK" },
"T", String());
208 PropertyImpl::checkSet(m_core->m_nb_task_thread, str);
215void ApplicationBuildInfo::
218 ApplicationCoreBuildInfo::setDefaultValues();
220 String str = m_core->getValue({
"ARCANE_NB_THREAD" },
"S", String());
221 PropertyImpl::checkSet(m_p->m_nb_shared_memory_sub_domain, str);
224 String str = m_core->getValue({
"ARCANE_NB_REPLICATION" },
"R", String());
225 PropertyImpl::checkSet(m_p->m_nb_replication_sub_domain, str);
228 String str = m_core->getValue({
"ARCANE_NB_SUB_DOMAIN" },
"P", String());
229 PropertyImpl::checkSet(m_p->m_nb_processus_sub_domain, str);
232 String str = m_core->getValue({
"ARCANE_OUTPUT_LEVEL" },
"OutputLevel",
233 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL));
234 PropertyImpl::checkSet(m_p->m_output_level, str);
237 String str = m_core->getValue({
"ARCANE_VERBOSITY_LEVEL",
"ARCANE_VERBOSE_LEVEL" },
"VerbosityLevel",
238 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL));
239 PropertyImpl::checkSet(m_p->m_verbosity_level, str);
242 String str = m_core->getValue({},
"MinimalVerbosityLevel",
243 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL));
244 PropertyImpl::checkSet(m_p->m_minimal_verbosity_level, str);
247 String str = m_core->getValue({
"ARCANE_MASTER_HAS_OUTPUT_FILE" },
"MasterHasOutputFile",
"0");
248 PropertyImpl::checkSet(m_p->m_is_master_has_output_file, str);
251 String str = m_core->getValue({
"ARCANE_OUTPUT_DIRECTORY" },
"OutputDirectory",
253 PropertyImpl::checkSet(m_p->m_output_directory, str);
256 String str = m_core->getValue({},
"CaseDatasetFileName",
259 m_p->m_case_dataset_source.setFileName(str);
262 String str = m_core->getValue({
"ARCANE_THREAD_BINDING_STRATEGY" },
"ThreadBindingStrategy",
264 PropertyImpl::checkSet(m_p->m_thread_binding_strategy, str);
271void ApplicationCoreBuildInfo::
275 String str = m_core->getValue({
"ARCANE_TASK_IMPLEMENTATION" },
"TaskService",
"TBB");
276 String service_name = str +
"TaskImplementation";
277 PropertyImpl::checkSet(m_core->m_task_implementation_services, service_name);
281 String thread_str = m_core->getValue({
"ARCANE_THREAD_IMPLEMENTATION" },
"ThreadService",
"Std");
282 list1.add(thread_str+
"ThreadImplementationService");
283 list1.add(
"TBBThreadImplementationService");
284 PropertyImpl::checkSet(m_core->m_thread_implementation_services, list1);
291void ApplicationBuildInfo::
294 ApplicationCoreBuildInfo::setDefaultServices();
295 bool has_shm = nbSharedMemorySubDomain()>0;
297 String def_name = (has_shm) ?
"Thread" :
"Sequential";
298 String default_service_name = def_name+
"ParallelSuperMng";
300 if (m_p->m_default_message_passing_service.null())
301 m_p->m_default_message_passing_service = default_service_name;
303 String str = m_core->getValue({
"ARCANE_PARALLEL_SERVICE" },
"MessagePassingService", String());
305 String service_name = str +
"ParallelSuperMng";
306 PropertyImpl::checkSet(m_p->m_message_passing_service, service_name);
314void ApplicationBuildInfo::
315setMessagePassingService(
const String& name)
317 m_p->m_message_passing_service = name;
320String ApplicationBuildInfo::
321messagePassingService()
const
323 return m_p->m_message_passing_service;
329void ApplicationCoreBuildInfo::
330setTaskImplementationService(
const String& name)
334 m_core->m_task_implementation_services = s;
336void ApplicationCoreBuildInfo::
337setTaskImplementationServices(
const StringList& names)
339 m_core->m_task_implementation_services = names;
342taskImplementationServices()
const
344 return m_core->m_task_implementation_services;
350void ApplicationCoreBuildInfo::
351setThreadImplementationService(
const String& name)
355 m_core->m_thread_implementation_services = s;
357void ApplicationCoreBuildInfo::
358setThreadImplementationServices(
const StringList& names)
360 m_core->m_thread_implementation_services = names;
363threadImplementationServices()
const
365 return m_core->m_thread_implementation_services;
371Int32 ApplicationCoreBuildInfo::
374 return m_core->m_nb_task_thread;
380void ApplicationCoreBuildInfo::
381setNbTaskThread(
Int32 v)
383 m_core->m_nb_task_thread = v;
389Int32 ApplicationBuildInfo::
390nbSharedMemorySubDomain()
const
392 return m_p->m_nb_shared_memory_sub_domain;
398void ApplicationBuildInfo::
399setNbSharedMemorySubDomain(
Int32 v)
401 m_p->m_nb_shared_memory_sub_domain = v;
407Int32 ApplicationBuildInfo::
408nbReplicationSubDomain()
const
410 return m_p->m_nb_replication_sub_domain;
416void ApplicationBuildInfo::
417setNbReplicationSubDomain(
Int32 v)
419 m_p->m_nb_replication_sub_domain = v;
425Int32 ApplicationBuildInfo::
426nbProcessusSubDomain()
const
428 return m_p->m_nb_processus_sub_domain;
434void ApplicationBuildInfo::
435setNbProcessusSubDomain(
Int32 v)
437 m_p->m_nb_processus_sub_domain = v;
446 return m_p->m_config_file_name;
455 m_p->m_config_file_name = v;
461Int32 ApplicationBuildInfo::
464 return m_p->m_output_level;
470 m_p->m_output_level = v;
476Int32 ApplicationBuildInfo::
477verbosityLevel()
const
479 return m_p->m_verbosity_level;
485 m_p->m_verbosity_level = v;
491Int32 ApplicationBuildInfo::
492minimalVerbosityLevel()
const
494 return m_p->m_minimal_verbosity_level;
497void ApplicationBuildInfo::
498setMinimalVerbosityLevel(Int32 v)
500 m_p->m_minimal_verbosity_level = v;
506bool ApplicationBuildInfo::
507isMasterHasOutputFile()
const
509 return m_p->m_is_master_has_output_file;
512void ApplicationBuildInfo::
513setIsMasterHasOutputFile(
bool v)
515 m_p->m_is_master_has_output_file = v;
521String ApplicationBuildInfo::
522outputDirectory()
const
524 return m_p->m_output_directory;
533 m_p->m_output_directory = v;
542 return m_p->m_thread_binding_strategy;
548 m_p->m_thread_binding_strategy = v;
554void ApplicationCoreBuildInfo::
557 m_core->addKeyValue(name, value);
572 addParameter(names[i],values[i]);
581_internalApplicationInfo()
583 return m_p->m_app_info;
589const ApplicationInfo& ApplicationBuildInfo::
590_internalApplicationInfo()
const
592 return m_p->m_app_info;
606 return m_p->m_app_info.applicationName();
615 m_p->m_app_info.setCodeVersion(version_info);
621 return m_p->m_app_info.codeVersion();
630 m_p->m_app_info.setCodeName(code_name);
636 return m_p->m_app_info.codeName();
645 return m_p->m_case_dataset_source;
651 return m_p->m_case_dataset_source;
660 m_p->m_app_info.addDynamicLibrary(lib_name);
669 m_p->m_default_message_passing_service = name;
675String ApplicationBuildInfo::
676internalDefaultMessagePassingService()
const
678 return m_p->m_default_message_passing_service;
void setVerbosityLevel(Int32 v)
Positionne le niveau de verbosité des messages des fichiers listings réduits.
void setOutputDirectory(const String &name)
Positionne le répertoire contenant les différentes sorties de la simulation.
VersionInfo codeVersion() const
Numéro de version.
void setOutputLevel(Int32 v)
Positionne le niveau de verbosité des messages sur la sortie standard.
String configFileName() const
Nom du fichier de configuration du code.
void addDynamicLibrary(const String &lib_name)
Ajoute la bibliothèque lib_name à la liste des bibliothèques chargées dynamiquements.
void internalSetDefaultMessagePassingService(const String &name)
Nom du gestionnaire de message par défaut. Ne doit être modifié que par Arcane.
void setCodeName(const String &code_name)
Positionne le nom du code.
String applicationName() const
Nom de l'application.
void setApplicationName(const String &v)
Positionne le nom de l'application.
String codeName() const
Retourne le nom du code.
CaseDatasetSource & caseDatasetSource()
Source du jeu de données.
void setConfigFileName(const String &name)
Positionne le fichier de configuration du code.
void setCodeVersion(const VersionInfo &version_info)
Positionne le numéro de version du code.
String threadBindingStrategy() const
Stratégie pour punaiser les threads des tâches.
Informations pour initialiser une application.
void parseArgumentsAndSetDefaultsValues(const CommandLineArguments &args)
Analyse les arguments de args.
Informations sur une application.
void setApplicationName(const String &v)
Positionne le nom de l'application.
Source d'un jeu de données d'un cas.
Integer count() const
Nombre d'éléments de la collection.
Arguments de la ligne de commande.
void fillParameters(StringList ¶m_names, StringList &values) const
Récupère la liste des paramètres et leur valeur.
Chaîne de caractères unicode.
Vecteur 1D de données avec sémantique par valeur (style STL).
Informations sur une version.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.
List< String > StringList
Tableau de chaînes de caractères unicode.
std::int32_t Int32
Type entier signé sur 32 bits.