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"
26#include "arccore/common/internal/ArccoreApplicationBuildInfoImpl.h"
43 x = std::min(std::max(x, min_value), max_value);
52 template <
typename T>
using FieldProperty = PropertyImpl::FieldProperty<T>;
57 : m_nb_shared_memory_sub_domain(0)
58 , m_nb_replication_sub_domain(0)
59 , m_nb_processus_sub_domain(0)
60 , m_config_file_name(
"")
65 m_nb_shared_memory_sub_domain.setValidator([](
Int32& x) { _clamp(x, 0, 1024); });
66 m_nb_replication_sub_domain.setValidator([](
Int32& x) { x = std::max(x, 0); });
67 m_nb_processus_sub_domain.setValidator([](
Int32& x) { x = std::max(x, 0); });
73 FieldProperty<String> m_message_passing_service;
74 FieldProperty<Int32> m_nb_shared_memory_sub_domain;
75 FieldProperty<Int32> m_nb_replication_sub_domain;
76 FieldProperty<Int32> m_nb_processus_sub_domain;
77 FieldProperty<String> m_config_file_name;
78 FieldProperty<Int32> m_output_level;
79 FieldProperty<Int32> m_verbosity_level;
80 FieldProperty<Int32> m_minimal_verbosity_level;
81 FieldProperty<bool> m_is_master_has_output_file;
82 FieldProperty<String> m_output_directory;
83 FieldProperty<String> m_thread_binding_strategy;
86 String m_default_message_passing_service;
101ApplicationBuildInfo::
104, m_p(new Impl(*rhs.m_p))
108ApplicationBuildInfo& ApplicationBuildInfo::
109operator=(
const ApplicationBuildInfo& rhs)
111 ArccoreApplicationBuildInfo::operator=(rhs);
114 m_p =
new Impl(*(rhs.m_p));
122ApplicationBuildInfo::
123~ApplicationBuildInfo()
131void ApplicationBuildInfo::
134 ArccoreApplicationBuildInfo::setDefaultValues();
136 String str = m_core->getValue({
"ARCANE_PARALLEL_SERVICE" },
"MessagePassingService", String());
138 String service_name = str +
"ParallelSuperMng";
139 PropertyImpl::checkSet(m_p->m_message_passing_service, service_name);
143 String str = m_core->getValue({
"ARCANE_NB_THREAD" },
"S", String());
144 PropertyImpl::checkSet(m_p->m_nb_shared_memory_sub_domain, str);
147 String str = m_core->getValue({
"ARCANE_NB_REPLICATION" },
"R", String());
148 PropertyImpl::checkSet(m_p->m_nb_replication_sub_domain, str);
151 String str = m_core->getValue({
"ARCANE_NB_SUB_DOMAIN" },
"P", String());
152 PropertyImpl::checkSet(m_p->m_nb_processus_sub_domain, str);
155 String str = m_core->getValue({
"ARCANE_OUTPUT_LEVEL" },
"OutputLevel",
156 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL));
157 PropertyImpl::checkSet(m_p->m_output_level, str);
160 String str = m_core->getValue({
"ARCANE_VERBOSITY_LEVEL",
"ARCANE_VERBOSE_LEVEL" },
"VerbosityLevel",
161 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL));
162 PropertyImpl::checkSet(m_p->m_verbosity_level, str);
165 String str = m_core->getValue({},
"MinimalVerbosityLevel",
166 String::fromNumber(Trace::UNSPECIFIED_VERBOSITY_LEVEL));
167 PropertyImpl::checkSet(m_p->m_minimal_verbosity_level, str);
170 String str = m_core->getValue({
"ARCANE_MASTER_HAS_OUTPUT_FILE" },
"MasterHasOutputFile",
"0");
171 PropertyImpl::checkSet(m_p->m_is_master_has_output_file, str);
174 String str = m_core->getValue({
"ARCANE_OUTPUT_DIRECTORY" },
"OutputDirectory",
176 PropertyImpl::checkSet(m_p->m_output_directory, str);
179 String str = m_core->getValue({},
"CaseDatasetFileName",
182 m_p->m_case_dataset_source.setFileName(str);
185 String str = m_core->getValue({
"ARCANE_THREAD_BINDING_STRATEGY" },
"ThreadBindingStrategy",
187 PropertyImpl::checkSet(m_p->m_thread_binding_strategy, str);
194void ArccoreApplicationBuildInfo::
198 String str = m_core->getValue({
"ARCANE_TASK_IMPLEMENTATION" },
"TaskService",
"TBB");
199 String service_name = str +
"TaskImplementation";
200 PropertyImpl::checkSet(m_core->m_task_implementation_services, service_name);
204 String thread_str = m_core->getValue({
"ARCANE_THREAD_IMPLEMENTATION" },
"ThreadService",
"Std");
205 list1.add(thread_str +
"ThreadImplementationService");
206 list1.add(
"TBBThreadImplementationService");
207 PropertyImpl::checkSet(m_core->m_thread_implementation_services, list1);
214void ApplicationBuildInfo::
217 ArccoreApplicationBuildInfo::setDefaultServices();
218 bool has_shm = nbSharedMemorySubDomain() > 0;
220 String def_name = (has_shm) ?
"Thread" :
"Sequential";
221 String default_service_name = def_name +
"ParallelSuperMng";
223 if (m_p->m_default_message_passing_service.null())
224 m_p->m_default_message_passing_service = default_service_name;
231void ApplicationBuildInfo::
232setMessagePassingService(
const String& name)
234 m_p->m_message_passing_service = name;
237String ApplicationBuildInfo::
238messagePassingService()
const
240 return m_p->m_message_passing_service;
246void ArccoreApplicationBuildInfo::
247setTaskImplementationService(
const String& name)
251 m_core->m_task_implementation_services = s;
253void ArccoreApplicationBuildInfo::
254setTaskImplementationServices(
const StringList& names)
256 m_core->m_task_implementation_services = names;
259taskImplementationServices()
const
261 return m_core->m_task_implementation_services;
267void ArccoreApplicationBuildInfo::
268setThreadImplementationService(
const String& name)
272 m_core->m_thread_implementation_services = s;
274void ArccoreApplicationBuildInfo::
275setThreadImplementationServices(
const StringList& names)
277 m_core->m_thread_implementation_services = names;
280threadImplementationServices()
const
282 return m_core->m_thread_implementation_services;
288Int32 ArccoreApplicationBuildInfo::
291 return m_core->m_nb_task_thread;
297void ArccoreApplicationBuildInfo::
298setNbTaskThread(
Int32 v)
300 m_core->m_nb_task_thread = v;
306Int32 ApplicationBuildInfo::
307nbSharedMemorySubDomain()
const
309 return m_p->m_nb_shared_memory_sub_domain;
315void ApplicationBuildInfo::
316setNbSharedMemorySubDomain(
Int32 v)
318 m_p->m_nb_shared_memory_sub_domain = v;
324Int32 ApplicationBuildInfo::
325nbReplicationSubDomain()
const
327 return m_p->m_nb_replication_sub_domain;
333void ApplicationBuildInfo::
334setNbReplicationSubDomain(
Int32 v)
336 m_p->m_nb_replication_sub_domain = v;
342Int32 ApplicationBuildInfo::
343nbProcessusSubDomain()
const
345 return m_p->m_nb_processus_sub_domain;
351void ApplicationBuildInfo::
352setNbProcessusSubDomain(
Int32 v)
354 m_p->m_nb_processus_sub_domain = v;
363 return m_p->m_config_file_name;
372 m_p->m_config_file_name = v;
378Int32 ApplicationBuildInfo::
381 return m_p->m_output_level;
387 m_p->m_output_level = v;
393Int32 ApplicationBuildInfo::
394verbosityLevel()
const
396 return m_p->m_verbosity_level;
402 m_p->m_verbosity_level = v;
408Int32 ApplicationBuildInfo::
409minimalVerbosityLevel()
const
411 return m_p->m_minimal_verbosity_level;
414void ApplicationBuildInfo::
415setMinimalVerbosityLevel(Int32 v)
417 m_p->m_minimal_verbosity_level = v;
423bool ApplicationBuildInfo::
424isMasterHasOutputFile()
const
426 return m_p->m_is_master_has_output_file;
429void ApplicationBuildInfo::
430setIsMasterHasOutputFile(
bool v)
432 m_p->m_is_master_has_output_file = v;
438String ApplicationBuildInfo::
439outputDirectory()
const
441 return m_p->m_output_directory;
450 m_p->m_output_directory = v;
459 return m_p->m_thread_binding_strategy;
465 m_p->m_thread_binding_strategy = v;
471void ArccoreApplicationBuildInfo::
474 m_core->addKeyValue(name, value);
489 addParameter(names[i], values[i]);
498_internalApplicationInfo()
500 return m_p->m_app_info;
506const ApplicationInfo& ApplicationBuildInfo::
507_internalApplicationInfo()
const
509 return m_p->m_app_info;
523 return m_p->m_app_info.applicationName();
532 m_p->m_app_info.setCodeVersion(version_info);
538 return m_p->m_app_info.codeVersion();
547 m_p->m_app_info.setCodeName(code_name);
553 return m_p->m_app_info.codeName();
562 return m_p->m_case_dataset_source;
568 return m_p->m_case_dataset_source;
577 m_p->m_app_info.addDynamicLibrary(lib_name);
586 m_p->m_default_message_passing_service = name;
592String ApplicationBuildInfo::
593internalDefaultMessagePassingService()
const
595 return m_p->m_default_message_passing_service;
Information for constructing an instance of IApplication.
void setVerbosityLevel(Int32 v)
Sets the message verbosity level of reduced listing files.
void setOutputDirectory(const String &name)
Sets the directory containing the various simulation outputs.
VersionInfo codeVersion() const
Version number.
void setOutputLevel(Int32 v)
Sets the message verbosity level on standard output.
String configFileName() const
Name of the code configuration file.
void addDynamicLibrary(const String &lib_name)
Adds the library lib_name to the list of dynamically loaded libraries.
void internalSetDefaultMessagePassingService(const String &name)
Default message passing manager name. Must only be modified by Arcane.
void setCodeName(const String &code_name)
Sets the code name.
String applicationName() const
Application name.
void setApplicationName(const String &v)
Sets the application name.
String codeName() const
Returns the code name.
CaseDatasetSource & caseDatasetSource()
Dataset source.
void setConfigFileName(const String &name)
Sets the code configuration file.
void setCodeVersion(const VersionInfo &version_info)
Sets the code version.
String threadBindingStrategy() const
Strategy for binding task threads.
void setApplicationName(const String &v)
Sets the application name.
Information for initializing an application.
void parseArgumentsAndSetDefaultsValues(const CommandLineArguments &args)
Parses the arguments in args.
Source of a case dataset.
Integer count() const
Number of elements in the collection.
void fillParameters(StringList ¶m_names, StringList &values) const
Retrieves the list of parameters and their values.
Unicode character string.
Information about a version.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
List< String > StringList
Unicode string list.
std::int32_t Int32
Signed integer type of 32 bits.