14#include "arcane/ApplicationBuildInfo.h"
16#include "arcane/utils/PlatformUtils.h"
17#include "arcane/utils/String.h"
18#include "arcane/utils/List.h"
19#include "arcane/utils/ValueConvert.h"
20#include "arcane/utils/CommandLineArguments.h"
21#include "arcane/utils/TraceClassConfig.h"
22#include "arcane/utils/ApplicationInfo.h"
24#include "arcane/CaseDatasetSource.h"
41 x = std::min(std::max(x,min_value),max_value);
58 template<
typename DataType>
66 operator DataType()
const {
return m_value; }
68 void setValue(
const DataType& v)
79 DataType value()
const {
return m_value; }
80 bool isValueSet()
const {
return m_has_value; }
81 void setValidator(std::function<
void(DataType&)>&&
func) { m_validator =
func; }
84 DataType m_default_value;
86 std::function<
void(DataType&)> m_validator;
92 operator Int32()
const {
return value; }
107 : m_nb_task_thread(-1), m_nb_shared_memory_sub_domain(0),
108 m_nb_replication_sub_domain(0), m_nb_processus_sub_domain(0),
109 m_config_file_name(
"")
112 m_nb_task_thread.setValidator([](Int32& x){
_clamp(x,-1,512); });
116 m_nb_shared_memory_sub_domain.setValidator([](Int32& x){
_clamp(x,0,1024); });
117 m_nb_replication_sub_domain.setValidator([](Int32& x){ x = std::max(x,0); });
118 m_nb_processus_sub_domain.setValidator([](
Int32& x){ x = std::max(x,0); });
121 Property<String> m_message_passing_service;
122 Property<StringList> m_task_implementation_services;
123 Property<StringList> m_thread_implementation_services;
124 Property<Int32> m_nb_task_thread;
125 Property<Int32> m_nb_shared_memory_sub_domain;
126 Property<Int32> m_nb_replication_sub_domain;
127 Property<Int32> m_nb_processus_sub_domain;
128 Property<String> m_config_file_name;
129 Property<Int32> m_output_level;
130 Property<Int32> m_verbosity_level;
131 Property<Int32> m_minimal_verbosity_level;
132 Property<bool> m_is_master_has_output_file;
133 Property<String> m_output_directory;
134 Property<String> m_thread_binding_strategy;
135 UniqueArray<NameValuePair> m_values;
136 ApplicationInfo m_app_info;
137 CaseDatasetSource m_case_dataset_source;
138 String m_default_message_passing_service;
162 String ev = platform::getEnvironmentVariable(x);
176 return Int32Value(v);
178 void checkSet(Property<bool>& p,
const String& str_value)
182 if (str_value.null())
185 bool is_bad = builtInGetValue(v,str_value);
189 void checkSet(Property<Int32>& p,
const String& str_value)
193 if (str_value.null())
196 bool is_bad = builtInGetValue(v,str_value);
200 void checkSet(Property<StringList>& p,
const String& str_value)
204 if (str_value.null())
210 void checkSet(Property<StringList>& p,
const StringList& str_values)
214 p.setValue(str_values);
216 void checkSet(Property<String>& p,
const String& str_value)
220 if (str_value.null())
222 p.setValue(str_value);
225 String _searchParam(
const String& param_name)
229 for(
const auto& x : m_values ){
230 if (x.name==param_name)
240ApplicationBuildInfo::
241ApplicationBuildInfo()
249ApplicationBuildInfo::
250ApplicationBuildInfo(
const ApplicationBuildInfo& rhs)
251: m_p(new Impl(*rhs.m_p))
255ApplicationBuildInfo& ApplicationBuildInfo::
256operator=(
const ApplicationBuildInfo& rhs)
260 m_p =
new Impl(*(rhs.m_p));
268ApplicationBuildInfo::
269~ApplicationBuildInfo()
277void ApplicationBuildInfo::
281 String str = m_p->
getValue( {
"ARCANE_NB_TASK" },
"T", String() );
282 m_p->checkSet(m_p->m_nb_task_thread,str);
285 String str = m_p->
getValue( {
"ARCANE_NB_THREAD" },
"S", String() );
286 m_p->checkSet(m_p->m_nb_shared_memory_sub_domain,str);
289 String str = m_p->
getValue( {
"ARCANE_NB_REPLICATION" },
"R", String() );
290 m_p->checkSet(m_p->m_nb_replication_sub_domain,str);
293 String str = m_p->
getValue( {
"ARCANE_NB_SUB_DOMAIN" },
"P", String() );
294 m_p->checkSet(m_p->m_nb_processus_sub_domain,str);
297 String str = m_p->
getValue( {
"ARCANE_OUTPUT_LEVEL" },
"OutputLevel",
298 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL) );
299 m_p->checkSet(m_p->m_output_level,str);
302 String str = m_p->
getValue( {
"ARCANE_VERBOSITY_LEVEL",
"ARCANE_VERBOSE_LEVEL" },
"VerbosityLevel",
303 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL) );
304 m_p->checkSet(m_p->m_verbosity_level,str);
307 String str = m_p->
getValue( { },
"MinimalVerbosityLevel",
308 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL) );
309 m_p->checkSet(m_p->m_minimal_verbosity_level,str);
312 String str = m_p->
getValue( {
"ARCANE_MASTER_HAS_OUTPUT_FILE" },
"MasterHasOutputFile",
"0" );
313 m_p->checkSet(m_p->m_is_master_has_output_file,str);
316 String str = m_p->
getValue( {
"ARCANE_OUTPUT_DIRECTORY" },
"OutputDirectory",
318 m_p->checkSet(m_p->m_output_directory,str);
321 String str = m_p->
getValue( { },
"CaseDatasetFileName",
327 String str = m_p->
getValue( {
"ARCANE_THREAD_BINDING_STRATEGY" },
"ThreadBindingStrategy",
329 m_p->checkSet(m_p->m_thread_binding_strategy,str);
336void ApplicationBuildInfo::
339 bool has_shm = nbSharedMemorySubDomain()>0;
341 String str = m_p->
getValue( {
"ARCANE_TASK_IMPLEMENTATION" },
"TaskService",
"TBB");
342 String service_name = str+
"TaskImplementation";
343 m_p->checkSet(m_p->m_task_implementation_services,service_name);
347 String thread_str = m_p->
getValue( {
"ARCANE_THREAD_IMPLEMENTATION" },
"ThreadService" ,
"TBB");
348 list1.add(thread_str+
"ThreadImplementationService");
349 list1.add(
"StdThreadImplementationService");
350 m_p->checkSet(m_p->m_thread_implementation_services,list1);
353 String def_name = (has_shm) ?
"Thread" :
"Sequential";
354 String default_service_name = def_name+
"ParallelSuperMng";
356 if (m_p->m_default_message_passing_service.
null())
357 m_p->m_default_message_passing_service = default_service_name;
359 String str = m_p->
getValue( {
"ARCANE_PARALLEL_SERVICE" },
"MessagePassingService", String() );
361 String service_name = str+
"ParallelSuperMng";
362 m_p->checkSet(m_p->m_message_passing_service,service_name);
370void ApplicationBuildInfo::
371setMessagePassingService(
const String& name)
373 m_p->m_message_passing_service = name;
376String ApplicationBuildInfo::
377messagePassingService()
const
379 return m_p->m_message_passing_service;
385void ApplicationBuildInfo::
386setTaskImplementationService(
const String& name)
390 m_p->m_task_implementation_services = s;
392void ApplicationBuildInfo::
393setTaskImplementationServices(
const StringList& names)
395 m_p->m_task_implementation_services = names;
398taskImplementationServices()
const
400 return m_p->m_task_implementation_services;
406void ApplicationBuildInfo::
407setThreadImplementationService(
const String& name)
411 m_p->m_thread_implementation_services = s;
413void ApplicationBuildInfo::
414setThreadImplementationServices(
const StringList& names)
416 m_p->m_thread_implementation_services = names;
419threadImplementationServices()
const
421 return m_p->m_thread_implementation_services;
427Int32 ApplicationBuildInfo::
430 return m_p->m_nb_task_thread;
436void ApplicationBuildInfo::
437setNbTaskThread(
Int32 v)
439 m_p->m_nb_task_thread = v;
445Int32 ApplicationBuildInfo::
446nbSharedMemorySubDomain()
const
448 return m_p->m_nb_shared_memory_sub_domain;
454void ApplicationBuildInfo::
455setNbSharedMemorySubDomain(
Int32 v)
457 m_p->m_nb_shared_memory_sub_domain = v;
463Int32 ApplicationBuildInfo::
464nbReplicationSubDomain()
const
466 return m_p->m_nb_replication_sub_domain;
472void ApplicationBuildInfo::
473setNbReplicationSubDomain(
Int32 v)
475 m_p->m_nb_replication_sub_domain = v;
481Int32 ApplicationBuildInfo::
482nbProcessusSubDomain()
const
484 return m_p->m_nb_processus_sub_domain;
490void ApplicationBuildInfo::
491setNbProcessusSubDomain(
Int32 v)
493 m_p->m_nb_processus_sub_domain = v;
502 return m_p->m_config_file_name;
511 m_p->m_config_file_name = v;
517Int32 ApplicationBuildInfo::
520 return m_p->m_output_level;
526 m_p->m_output_level = v;
532Int32 ApplicationBuildInfo::
533verbosityLevel()
const
535 return m_p->m_verbosity_level;
541 m_p->m_verbosity_level = v;
547Int32 ApplicationBuildInfo::
548minimalVerbosityLevel()
const
550 return m_p->m_minimal_verbosity_level;
553void ApplicationBuildInfo::
554setMinimalVerbosityLevel(
Int32 v)
556 m_p->m_minimal_verbosity_level = v;
562bool ApplicationBuildInfo::
563isMasterHasOutputFile()
const
565 return m_p->m_is_master_has_output_file;
568void ApplicationBuildInfo::
569setIsMasterHasOutputFile(
bool v)
571 m_p->m_is_master_has_output_file = v;
577String ApplicationBuildInfo::
578outputDirectory()
const
580 return m_p->m_output_directory;
589 m_p->m_output_directory = v;
598 return m_p->m_thread_binding_strategy;
604 m_p->m_thread_binding_strategy = v;
610void ApplicationBuildInfo::
613 m_p->m_values.add(Impl::NameValuePair(name,value));
627 for( Integer i=0, n=
names.count(); i<n; ++i ){
628 addParameter(
names[i],values[i]);
637_internalApplicationInfo()
639 return m_p->m_app_info;
645const ApplicationInfo& ApplicationBuildInfo::
646_internalApplicationInfo()
const
648 return m_p->m_app_info;
701 return m_p->m_case_dataset_source;
707 return m_p->m_case_dataset_source;
725 m_p->m_default_message_passing_service = name;
731String ApplicationBuildInfo::
732internalDefaultMessagePassingService()
const
734 return m_p->m_default_message_passing_service;
String getValue(const UniqueArray< String > &env_values, const String ¶m_name, const String &default_value)
Récupère la valeur d'une option.
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 parseArguments(const CommandLineArguments &args)
Analyse les arguments de args.
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 sur une application.
const String & codeName() const
Retourne le nom du code de calcul lié l'application.
void setCodeVersion(const VersionInfo &version_info)
Positionne le numéro de version.
const String & applicationName() const
Nom de l'application.
void addDynamicLibrary(const String &lib_name)
Ajoute la bibliothèque lib_name à la liste des bibliothèques chargées dynamiquements.
const VersionInfo & codeVersion() const
Numéro de version.
void setApplicationName(const String &v)
Positionne le nom de l'application.
void setCodeName(const String &code_name)
Positionne le nom du code.
Source d'un jeu de données d'un cas.
void setFileName(const String &name)
Positionne le nom du fichier du jeu de données.
Arguments de la ligne de commande.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Informations sur une version.
Chaîne de caractères unicode.
bool null() const
Retourne true si la chaîne est nulle.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
List< String > StringList
Tableau de chaînes de caractères unicode.