14#include "arcane/impl/ArcaneMain.h"
16#include "arcane/utils/Iostream.h"
17#include "arcane/utils/List.h"
18#include "arcane/utils/Iterator.h"
19#include "arcane/utils/ScopedPtr.h"
20#include "arcane/utils/PlatformUtils.h"
21#include "arcane/utils/FatalErrorException.h"
22#include "arcane/utils/ParallelFatalErrorException.h"
23#include "arcane/utils/OStringStream.h"
24#include "arcane/utils/ApplicationInfo.h"
25#include "arcane/utils/ValueConvert.h"
26#include "arcane/utils/ITraceMng.h"
27#include "arcane/utils/SignalException.h"
28#include "arcane/utils/TimeoutException.h"
29#include "arcane/utils/NotImplementedException.h"
30#include "arcane/utils/ArithmeticException.h"
31#include "arcane/utils/StringBuilder.h"
32#include "arcane/utils/IDynamicLibraryLoader.h"
33#include "arcane/utils/CheckedConvert.h"
34#include "arcane/utils/CommandLineArguments.h"
35#include "arcane/utils/TestLogger.h"
37#include "arcane/utils/internal/MemoryUtilsInternal.h"
38#include "arcane/utils/internal/ValueConvertInternal.h"
40#include "arcane/core/IMainFactory.h"
41#include "arcane/core/IApplication.h"
42#include "arcane/core/IServiceLoader.h"
43#include "arcane/core/IParallelMng.h"
44#include "arcane/core/IParallelSuperMng.h"
45#include "arcane/core/IIOMng.h"
46#include "arcane/core/ISession.h"
47#include "arcane/core/ISubDomain.h"
48#include "arcane/core/IRessourceMng.h"
49#include "arcane/core/IModuleMng.h"
50#include "arcane/core/IModule.h"
51#include "arcane/core/IVariableMng.h"
52#include "arcane/core/VariableRef.h"
53#include "arcane/core/ITimeLoopMng.h"
54#include "arcane/core/ITimeLoop.h"
55#include "arcane/core/Directory.h"
56#include "arcane/core/XmlNodeList.h"
57#include "arcane/core/IXmlDocumentHolder.h"
58#include "arcane/core/ItemTypeMng.h"
59#include "arcane/core/ServiceUtils.h"
60#include "arcane/core/ICodeService.h"
61#include "arcane/core/CaseOptions.h"
62#include "arcane/core/VariableCollection.h"
63#include "arcane/core/ItemGroupImpl.h"
64#include "arcane/core/SubDomainBuildInfo.h"
65#include "arcane/core/ICaseMng.h"
66#include "arcane/core/DotNetRuntimeInitialisationInfo.h"
67#include "arcane/core/AcceleratorRuntimeInitialisationInfo.h"
68#include "arcane/core/ApplicationBuildInfo.h"
70#include "arcane/core/IServiceFactory.h"
71#include "arcane/core/IModuleFactory.h"
73#include "arcane/impl/MainFactory.h"
74#include "arcane/impl/InternalInfosDumper.h"
75#include "arcane/impl/internal/ArcaneMainExecInfo.h"
76#include "arcane/impl/internal/ThreadBindingMng.h"
78#include "arcane/accelerator/core/internal/RegisterRuntimeInfo.h"
80#include "arcane_internal_config.h"
84#ifndef ARCANE_OS_WIN32
95#include "arcane/impl/FlexLMTools.h"
112 bool m_has_dotnet_wrapper =
false;
131 if (!global_static_info)
133 return global_static_info;
135void _deleteStaticInfo()
137 delete global_static_info;
138 global_static_info =
nullptr;
145extern "C" void arcaneEndProgram()
154typedef void (*fSignalFunc)(int);
155void arcaneSignalHandler(
int);
167extern "C++" ARCANE_UTILS_EXPORT
void
168arcaneRedirectSignals(fSignalFunc sig_func);
170extern "C++" ARCANE_UTILS_EXPORT
void
171arcaneCallDefaultSignal(
int val);
173extern "C++" ARCANE_UTILS_EXPORT
void
174initializeStringConverter();
180createGlibDynamicLibraryLoader();
185extern "C++" ARCANE_UTILS_EXPORT
void
186arcanePrintSpecificMemoryStats();
190bool ArcaneMain::m_has_garbage_collector =
false;
191bool ArcaneMain::m_is_master_io =
true;
192bool ArcaneMain::m_is_use_test_logger =
false;
204 return createArcaneMainBatch(app_info,
this);
225 , m_application_build_info(build_infos)
226 , m_dotnet_info(dotnet_info)
227 , m_accelerator_info(accelerator_info)
248 bool redirect_signals =
true;
250 (void)builtInGetValue(redirect_signals, rv);
251 if (redirect_signals) {
260setUseTestLogger(
bool v)
262 m_is_use_test_logger = v;
271 m_default_main_factory = mf;
277class ArcaneMainExecFunctor
283 : m_app_info(app_info)
284 , m_exec_main(exec_main)
293 m_app_info.args(args);
294 if (!m_exec_main->parseArgs(args))
295 m_exec_main->execute();
318 auto* x = _staticInfo();
319 if (x->m_nb_autodetect > 0)
320 return x->m_autodetect_return_value;
322 ArcaneMain::_setArcaneLibraryPath();
324 std::chrono::high_resolution_clock clock;
328 ArcaneMain::_checkAutoDetectMPI();
330 bool has_accelerator =
false;
334 auto start_time = clock.now();
336 auto end_time = clock.now();
339 x->m_init_time_accelerator = _getTime(end_time,start_time);
340 ++x->m_nb_autodetect;
342 return x->m_autodetect_return_value;
345 template<
typename TimeType>
346 Real _getTime(TimeType end_time,TimeType start_time)
348 auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(end_time - start_time);
349 Real x =
static_cast<Real>(duration.count());
372 m_clean_abort =
false;
374 ArcaneMain::redirectSignals();
378 if (m_has_build_info) {
380 m_application_build_info,
386 m_exec_main = m_main_factory->createArcaneMain(
m_app_info);
388 m_exec_main->build();
389 ArcaneMain::m_is_master_io = m_exec_main->application()->parallelSuperMng()->isMasterIO();
390 m_exec_main->initialize();
394 cerr <<
"** CATCH ARITHMETIC_EXCEPTION\n";
395 return arcanePrintArcaneException(ex,
nullptr);
398 return arcanePrintArcaneException(ex,
nullptr);
400 catch (
const std::exception& ex) {
401 return arcanePrintStdException(ex,
nullptr);
404 return arcanePrintAnyException(
nullptr);
410 ArcaneMain::redirectSignals();
413 m_clean_abort =
false;
420 trace->
info() <<
"Initializing license manager";
435 m_ret_val = arcanePrintArcaneException(ex, trace);
437 m_clean_abort =
true;
447void ArcaneMainExecInfo::
453 if (m_direct_exec_functor)
454 m_exec_main->setDirectExecuteFunctor(m_direct_exec_functor);
457 if (ArcaneMain::m_exec_override_functor) {
460 ArcaneMain::m_exec_override_functor->m_application = app;
462 trace->
info() <<
"Calling overriding functor";
464 m_exec_main, &m_clean_abort,
true);
473void ArcaneMainExecInfo::
481 int exe_error_code = m_exec_main->errorCode();
482 if (m_ret_val == 0 && exe_error_code != 0) {
483 m_ret_val = exe_error_code;
485 else if (m_ret_val != 0)
486 m_exec_main->setErrorCode(m_ret_val);
488 m_exec_main->finalize();
490 if (m_ret_val != 0 && !m_clean_abort)
491 m_exec_main->doAbort();
498 m_exec_main =
nullptr;
499#ifndef ARCANE_USE_MPC
516 ArcaneMainExecInfo exec_info(app_info, factory);
523 exec_info.setDirectExecFunctor(func);
525 exec_info.finalize();
527 return exec_info.returnValue();
535 bool* clean_abort,
bool is_print)
538 *clean_abort =
false;
544 functor->executeFunctor();
551 if (is_master && is_print) {
552 std::ofstream ofile(
"fatal");
553 ofile << ret_val <<
'\n';
555 trace->
error() <<
"ParallelFatalErrorException caught in ArcaneMain::callFunctor: " << ex <<
'\n';
559 trace->
error() <<
"ParallelFatalErrorException caught in ArcaneMain::callFunctor: " << ex <<
'\n';
564 trace->
error() << Trace::Color::red() <<
"FatalErrorException caught in ArcaneMain::callFunctor: " << ex <<
'\n';
569 trace->
error() <<
"SignalException caught in ArcaneMain::callFunctor: " << ex <<
'\n';
573 trace->
error() <<
"TimeoutException caught in ArcaneMain::callFunctor: " << ex <<
'\n';
581 if (is_master && is_print) {
582 std::ofstream ofile(
"fatal");
583 ofile << ret_val <<
'\n';
585 trace->
error() <<
"ParallelFatalErrorException caught in ArcaneMain::callFunctor: " << ex <<
'\n';
589 trace->
error() <<
"ParallelFatalErrorException caught in ArcaneMain::callFunctor: " << ex <<
'\n';
594 cerr <<
"** ARITHMETIC EXCEPTION!\n";
595 ret_val = arcanePrintArcaneException(ex, trace);
601 ret_val = arcanePrintArcaneException(ex, trace);
606 catch (
const std::exception& ex) {
607 ret_val = arcanePrintStdException(ex, trace);
610 ret_val = arcanePrintAnyException(trace);
619_launchMissingInitException()
621 cerr <<
"ArcaneMain: appel ArcaneMain::arcaneInitialize() manquant.\n";
622 throw std::exception();
632 _launchMissingInitException();
638extern "C++" void arcaneInitCheckMemory();
639extern "C++" void arcaneExitCheckMemory();
648 cerr <<
"WARNING: ArcaneMain::setHasGarbageCollector has to be called before arcaneInitialize\n";
651 m_has_garbage_collector =
true;
661 cerr <<
"WARNING: ArcaneMain::setHasDotNETRuntime has to be called before arcaneInitialize\n";
673 m_exec_override_functor = functor;
682 return _staticInfo()->m_has_dotnet_wrapper;
693_setArcaneLibraryPath()
697 if (!dll_full_path.
null())
701 _staticInfo()->m_arcane_lib_path = dir_name;
708_checkCreateDynamicLibraryLoader()
726 Exception::staticInit();
727 dom::DOMImplementation::initialize();
733 impl::arcaneSetIsValueConvertUseFromChars(v.value()==0);
737 initializeStringConverter();
738 arcaneInitCheckMemory();
741 _checkCreateDynamicLibraryLoader();
772 arcanePrintSpecificMemoryStats();
773 arcaneExitCheckMemory();
775 dom::DOMImplementation::terminate();
793 _staticInfo()->m_service_factory_infos.add(sri);
802 _staticInfo()->m_module_factory_infos.add(mfi);
811 _staticInfo()->m_application_build_info_visitors.add(visitor);
820 return _staticInfo()->m_app_build_info._internalApplicationInfo();
829 return _staticInfo()->m_dotnet_init_info;
838 return _staticInfo()->m_accelerator_init_info;
847 return _staticInfo()->m_app_build_info;
856 return m_p->m_application_build_info;
863_applicationBuildInfo()
865 return m_p->m_application_build_info;
874 return m_p->m_dotnet_info;
883 return m_p->m_accelerator_info;
892 return _staticInfo()->m_init_time_accelerator;
905 factory = m_default_main_factory;
908 default_factory = factory;
914 default_factory =
nullptr;
918 if (ret != 0 && ret != 5)
919 cerr <<
"* Process return: " << ret <<
'\n';
932 _staticInfo()->m_direct_exec_functor = func;
940_checkTestLoggerResult()
942 if (!m_is_use_test_logger)
946 return TestLogger::compare();
955 ArcaneMainAutoDetectRuntimeHelper auto_detect_helper;
956 return auto_detect_helper.check();
965 int r = _initRuntimes();
974 if (!is_in_dotnet && dotnet_info.isUsingDotNetRuntime()) {
979 bool do_finalize =
false;
995 return _checkTestLoggerResult();
1004 auto si = _staticInfo();
1005 si->m_has_dotnet_wrapper =
true;
1018 DotNetMainFunctor my_functor =
nullptr;
1019 String os_dir(si->m_arcane_lib_path);
1022 _checkCreateDynamicLibraryLoader();
1026 ARCANE_FATAL(
"No dynamic library available for running .Net");
1028 String dll_name =
"arcane_mono";
1029 String symbol_name =
"arcane_mono_main2";
1031 String runtime_name = dotnet_info.embeddedRuntime();
1033 if (runtime_name.
null() || runtime_name ==
"mono")
1036 else if (runtime_name ==
"coreclr") {
1037 dll_name =
"arcane_dotnet_coreclr";
1038 symbol_name =
"arcane_dotnet_coreclr_main";
1041 ARCANE_FATAL(
"Unknown '.Net' runtime '{0}'. Valid values are 'mono' or 'coreclr'", runtime_name);
1043 IDynamicLibrary* dl = dll_loader->
open(os_dir, dll_name);
1045 ARCANE_FATAL(
"Can not found dynamic library '{0}' for using .Net", dll_name);
1047 bool is_found =
false;
1048 void* functor_addr = dl->getSymbolAddress(symbol_name, &is_found);
1050 ARCANE_FATAL(
"Can not find symbol '{0}' in library '{1}'", symbol_name, dll_name);
1052 my_functor =
reinterpret_cast<DotNetMainFunctor
>(functor_addr);
1054 catch (
const Exception& ex) {
1055 return arcanePrintArcaneException(ex,
nullptr);
1057 catch (
const std::exception& ex) {
1058 return arcanePrintStdException(ex,
nullptr);
1061 return arcanePrintAnyException(
nullptr);
1065 const CommandLineArguments& cmd_args = app_info.commandLineArguments();
1067 String new_name = os_dir +
"/Arcane.Main.dll";
1068 return (*my_functor)(cmd_args, new_name);
1077_checkAutoDetectMPI()
1081 if (mp_service==
"Sequential")
1084 auto si = _staticInfo();
1089 typedef void (*ArcaneAutoDetectMPIFunctor)();
1091 _checkCreateDynamicLibraryLoader();
1097 String os_dir(si->m_arcane_lib_path);
1098 String dll_name =
"arcane_mpi";
1099 String symbol_name =
"arcaneAutoDetectMessagePassingServiceMPI";
1100 IDynamicLibrary* dl = dll_loader->open(os_dir, dll_name);
1104 bool is_found =
false;
1105 void* functor_addr = dl->getSymbolAddress(symbol_name, &is_found);
1109 auto my_functor =
reinterpret_cast<ArcaneAutoDetectMPIFunctor
>(functor_addr);
1129 has_accelerator =
false;
1130 String default_runtime_name;
1131#if defined(ARCANE_ACCELERATOR_RUNTIME)
1132 default_runtime_name = ARCANE_ACCELERATOR_RUNTIME;
1134 auto si = _staticInfo();
1136 if (!init_info.isUsingAcceleratorRuntime())
1138 String runtime_name = init_info.acceleratorRuntime();
1139 if (runtime_name ==
"sequential")
1141 if (runtime_name.
empty())
1142 runtime_name = default_runtime_name;
1143 if (runtime_name.
empty())
1148 if (runtime_name !=
"cuda" && runtime_name !=
"hip" && runtime_name !=
"sycl")
1149 ARCANE_FATAL(
"Invalid accelerator runtime '{0}'. Only 'cuda', 'hip' or 'sycl' is allowed", runtime_name);
1157 _checkCreateDynamicLibraryLoader();
1161 ARCANE_FATAL(
"No dynamic library available for running accelerator runtime");
1163 String os_dir(si->m_arcane_lib_path);
1164 String dll_name =
"arcane_accelerator_" + runtime_name +
"_runtime";
1165 String symbol_name =
"arcaneRegisterAcceleratorRuntime" + runtime_name;
1168 ARCANE_FATAL(
"Can not found dynamic library '{0}' for using accelerator runtime", dll_name);
1170 bool is_found =
false;
1172 if (!is_found || !functor_addr)
1173 ARCANE_FATAL(
"Can not find symbol '{0}' in library '{1}'", symbol_name, dll_name);
1175 auto my_functor =
reinterpret_cast<ArcaneAutoDetectAcceleratorFunctor
>(functor_addr);
1179 if (!verbose_str.
null())
1180 runtime_info.setVerbose(
true);
1186 (*my_functor)(runtime_info);
1187 has_accelerator =
true;
1191 if (!data_allocator_str.
null()){
1198 return arcanePrintArcaneException(ex,
nullptr);
1200 catch (
const std::exception& ex) {
1201 return arcanePrintStdException(ex,
nullptr);
1204 return arcanePrintAnyException(
nullptr);
1215IMainFactory* ArcaneMain::m_default_main_factory =
nullptr;
1223: m_p(new Impl(app_info))
1224, m_main_factory(factory)
1232ArcaneMain(
const ApplicationInfo& app_info, IMainFactory* factory,
1233 const ApplicationBuildInfo& app_build_info,
1234 const DotNetRuntimeInitialisationInfo& dotnet_info,
1235 const AcceleratorRuntimeInitialisationInfo& accelerator_info)
1236: m_p(new Impl(app_info, app_build_info, dotnet_info, accelerator_info))
1237, m_main_factory(factory)
1250 m_p->m_thread_binding_mng.finalize();
1251 delete m_application;
1264 _parseApplicationBuildInfoArgs();
1265 m_application = m_main_factory->createApplication(
this);
1266 m_p->m_thread_binding_mng.initialize(m_application->traceMng(),
1267 m_p->m_application_build_info.threadBindingStrategy());
1276 return m_p->m_app_info;
1283_parseApplicationBuildInfoArgs()
1289 auto& x = _staticInfo()->m_application_build_info_visitors;
1295 abi.setDefaultServices();
1304 m_application->initialize();
1307 service_loader->loadApplicationServices(m_application);
1316 return _staticInfo()->m_service_factory_infos;
1325 return _staticInfo()->m_module_factory_infos;
1352 m_error_code = errcode;
1356 if (ArcaneMain::m_is_master_io || errcode == 4) {
1357 String errname =
"fatal_" + String::fromNumber(errcode);
1358 std::ofstream ofile(errname.
localstr());
1371 bool arcane_internal =
false;
1373 bool arcane_all_internal =
false;
1375 bool arcane_database =
false;
1377 bool arcane_help =
false;
1379 String us_arcane_opt(
"-arcane_opt");
1381 String us_arcane_internal(
"arcane_internal");
1382 String us_arcane_all_internal(
"arcane_all_internal");
1383 String us_arcane_database(
"arcane_database");
1387 if (args[i].startsWith(
"-A")) {
1390 if (args[i] != us_arcane_opt) {
1391 unknown_args.add(args[i]);
1394 bool is_valid_opt =
false;
1399 if (str == us_arcane_internal) {
1400 arcane_internal =
true;
1401 is_valid_opt =
true;
1403 if (str == us_arcane_all_internal) {
1404 arcane_all_internal =
true;
1405 is_valid_opt =
true;
1407 if (str == us_arcane_database) {
1408 arcane_database =
true;
1409 is_valid_opt =
true;
1411 if (str == us_help) {
1413 is_valid_opt =
true;
1415 if (!is_valid_opt) {
1418 unknown_args.add(us_arcane_opt);
1420 unknown_args.add(str);
1425 bool do_stop =
false;
1426 if (arcane_database) {
1431 if (arcane_internal) {
1433 dumper.dumpInternalInfos();
1436 if (arcane_all_internal) {
1460 typedef std::multimap<String, IServiceInfo*>
ServiceList;
1467 std::set<IServiceInfo*> done_set;
1470 if (done_set.find(si) != done_set.end()) {
1473 done_set.insert(si);
1476 service_list.insert(std::make_pair(name, si));
1480 UniqueArray<String> module_names;
1481 for (EnumeratorT<IModuleFactoryInfo*> e =
application()->moduleFactoryInfos(); ++e;) {
1482 IModuleFactoryInfo* mfi = (*e);
1483 const String& name = mfi->moduleName();
1485 module_names.add(name);
1489 trace->
info() <<
" ";
1490 trace->info() << std::setw(max_name_size) <<
"Module List";
1491 trace->info() << std::setw(max_name_size) <<
"-------------"
1493 for (
int i = 0, n = module_names.size(); i < n; ++i) {
1494 trace->info() << std::setw(max_name_size) << module_names[i];
1497 trace->info() <<
" ";
1498 trace->info() << std::setw(max_name_size) <<
"Service List";
1499 trace->info() << std::setw(max_name_size) <<
"--------------"
1501 for (ServiceList::const_iterator i = service_list.begin(); i != service_list.end(); ++i) {
1502 IServiceInfo* si = i->second;
1504 oss() << std::setw(max_name_size) << i->first;
1506 if (!interfaces.empty())
1507 oss() <<
" Implements : ";
1508 for (EnumeratorT<String> e(interfaces.enumerator()); ++e;) {
1509 oss() << e.current() <<
" ";
1511 trace->info() << oss.str();
1514 const Integer option_size = 20;
1515 trace->info() <<
" ";
1516 trace->info() << std::setw(max_name_size) <<
"Usage";
1517 trace->info() << std::setw(max_name_size) <<
"-------"
1520 trace->info() <<
"Where OPTION is";
1521 trace->info() << std::setw(option_size) <<
"help"
1522 <<
" : this help page and abort";
1523 trace->info() << std::setw(option_size) <<
"arcane_internal"
1524 <<
" : save into a file internal Arcane informations and abort execution";
1525 trace->info() << std::setw(option_size) <<
"arcane_all_internal"
1526 <<
" : save into a file timeloop informations and abort execution";
1527 trace->info() << std::setw(option_size) <<
"arcane_database"
1528 <<
" : save internal database infos in file 'arcane_database.json'";
1529 trace->info() << std::setw(option_size) <<
"init_only"
1530 <<
" : only run initialization step";
1531 trace->info() << std::setw(option_size) <<
"continue"
1532 <<
" : continue an interrupted run";
1533 trace->info() << std::setw(option_size) <<
"max_iteration"
1534 <<
" : define maximum iteration number";
1535 trace->info() << std::setw(option_size) <<
"casename"
1536 <<
" : define case name";
1549 const char* signal_str =
"Unknown";
1550 bool is_alarm =
false;
1551 int written_signal_number = val;
1555 signal_str =
"Segmentation Fault";
1558 signal_str =
"Floating exception";
1562 signal_str =
"Bus Error";
1567 signal_str =
"System signal";
1572 signal_str =
"Broken pipe";
1577 signal_str =
"Sigalarm";
1583 signal_str =
"Sigalarm(VirtualTime)";
1584 written_signal_number = SIGALRM;
1590 cerr <<
"Signal Caught !!! number=" << val <<
" name=" << signal_str <<
".\n";
1595#ifndef ARCANE_OS_WIN32
1599 bool create_file = ArcaneMain::isMasterIO() || (!is_alarm);
1603 mode_t mode = S_IRUSR | S_IWUSR;
1605 sprintf(path,
"signal_%d", written_signal_number);
1607 int fd = ::open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
1617 Arcane::arcaneCallDefaultSignal(val);
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Fonctions de gestion mémoire et des allocateurs.
Informations pour l'initialisation des accélérateurs.
void setAcceleratorRuntime(StringView name)
Nom du runtime utilisé (pour l'instant uniquement 'cuda', 'hip' ou 'sycl')
Informations pour initialiser le runtime accélérateur.
Informations pour construire une instance de IApplication.
void parseArguments(const CommandLineArguments &args)
Analyse les arguments de args.
Informations sur une application.
const CommandLineArguments & commandLineArguments() const
Arguments de la ligne de commande.
IArcaneMain * createArcaneMain(const ApplicationInfo &app_info) override
Crée une instance de IArcaneMain.
Classe pour gérer les appels aux mécanismes d'auto-détection des runtimes (MPI,Accélérateurs).
void executeFunctor() override
Exécute la méthode associé
int initialize()
Création de l'instance 'IArcaneMain'.
const ApplicationInfo & m_app_info
ATTENTION: référence.
std::atomic< Int32 > m_nb_autodetect
Nombre de fois qu'on a lancé l'auto-détection pour MPI et les accélérateurs.
Real m_init_time_accelerator
Temps passé (en seconde) dans l'initialisation pour les accélérateurs.
Int32 m_autodetect_return_value
Code retour pour l'auto-détection.
Classe de gestion de l'exécution.
static ApplicationBuildInfo & defaultApplicationBuildInfo()
Informations pour l'initialisation des accélerateurs.
static AcceleratorRuntimeInitialisationInfo & defaultAcceleratorRuntimeInitialisationInfo()
Informations pour l'initialisation des accélerateurs.
static std::atomic< Int32 > m_nb_arcane_init
Nombre de fois que arcaneInitialize() a été appelé
static DotNetRuntimeInitialisationInfo & defaultDotNetRuntimeInitialisationInfo()
Informations pour l'initialisation du runtime '.Net'.
static void arcaneInitialize()
Initialise Arcane.
static void addApplicationBuildInfoVisitor(IApplicationBuildInfoVisitor *visitor)
Ajoute un visiteur pour remplir ApplicationBuildInfo.
const DotNetRuntimeInitialisationInfo & dotnetRuntimeInitialisationInfo() const override
Informations d'initialisation du runtime '.Net'.
static int _checkAutoDetectAccelerator(bool &has_accelerator)
Détecte et charge la gestion du runtime des accélérateurs.
static void arcaneFinalize()
Termine l'utilisation Arcane.
static int _arcaneMain(const ApplicationInfo &, IMainFactory *)
Point d'entrée de l'exécutable.
static Real initializationTimeForAccelerator()
Retourne le temps (en seconde) pour l'initialisation des runtimes accélérateurs pour ce processus.
const ApplicationInfo & applicationInfo() const override
Informations sur l'éxécutable.
ServiceFactoryInfoCollection registeredServiceFactoryInfos() override
Liste des fabriques de service enregistrées.
const AcceleratorRuntimeInitialisationInfo & acceleratorRuntimeInitialisationInfo() const override
Informations d'initialisation du runtime pour les accélérateurs.
static int callFunctorWithCatchedException(IFunctor *functor, IArcaneMain *amain, bool *clean_abort, bool is_print=true)
Appelle le fonctor functor en récupérant les éventuelles exceptions.
ModuleFactoryInfoCollection registeredModuleFactoryInfos() override
Liste des fabriques de module enregistrées.
void setErrorCode(int errcode) override
Positionne le code de retour.
static void setHasDotNETRuntime()
Indique que l'on tourne dans le runtime .NET.
IApplication * application() const override
Application.
static void setHasGarbageCollector()
Indique que certains objets sont gérés par un ramasse-miette.
static std::atomic< Int32 > m_is_init_done
1 si init terminé, 0 sinon
static int run()
Point d'entrée de l'exécutable dans Arcane.
static void addServiceFactoryInfo(IServiceFactoryInfo *factory)
Ajoute une fabrique de service.
void build() override
Construit les membres la classe. L'instance n'est pas utilisable tant que cette méthode n'a pas été a...
static ApplicationInfo & defaultApplicationInfo()
Infos par défaut de l'application.
static void setExecuteOverrideFunctor(ArcaneMainExecutionOverrideFunctor *functor)
static bool hasDotNetWrapper()
Indique si on exécute une assembly '.Net' depuis un main en C++.
const ApplicationBuildInfo & applicationBuildInfo() const override
Informations pour construire l'instance IApplication.
int execute() override
Lance l'exécution. Cette méthode ne retourne que lorsqu'on quitte le programme.
void doAbort() override
Effectue un abort.
static void setDefaultMainFactory(IMainFactory *mf)
Positionne la fabrique par défaut.
void initialize() override
Initialise l'instance. L'instance n'est pas utilisable tant que cette méthode n'a pas été appelée.
bool parseArgs(StringList args) override
Analyse les arguments.
static void addModuleFactoryInfo(IModuleFactoryInfo *factory)
Ajoute une fabrique de module.
Exception lorsqu'une erreur arithmétique survient.
void clear()
Supprime tous les éléments de la collection.
Integer count() const
Nombre d'éléments de la collection.
EnumeratorT< Internal::IServiceFactory2 * > Enumerator
Arguments de la ligne de commande.
String getParameter(const String ¶m_name) const
Récupère le paramètre de nom param_name.
Informations pour l'initialisation du runtime '.Net'.
Classe de base d'une exception.
bool isCollective() const
Vrai s'il s'agit d'une erreur collective (concerne tous les processeurs)
Exception lorsqu'une erreur fatale est survenue.
static FlexLMMng * instance()
Accès au singleton.
void init(IParallelSuperMng *parallel_super_mng)
Initialise le gestionnaire de licences.
void releaseAllLicenses()
Relache toutes les licences allouées.
Interface de l'application.
virtual String applicationName() const =0
Nom de l'application.
virtual IParallelSuperMng * parallelSuperMng()=0
Gestionnaire superviseur du parallélisme.
Interface de la classe de gestion du code.
virtual IApplication * application() const =0
Application.
static IArcaneMain * arcaneMain()
static void setArcaneMain(IArcaneMain *arcane_main)
virtual ITraceMng * traceMng() const =0
Gestionnaire de traces.
Interface d'un chargeur de cas.
Interface d'un fonctor pour exécuter du code directement après la création d'un sous-domaine sans pas...
Interface d'une chargeur dynamique de bibliothèque.
virtual IDynamicLibrary * open(const String &directory, const String &name)=0
Charge une bibliothèque dynamique.
Interface d'une bibliothèque dynamique.
virtual void * getSymbolAddress(const String &symbol_name, bool *is_found)=0
Retourne l'adresse du symbol de nom symbol_name.
Manufacture des classes d'Arcane.
Informations sur la fabrique d'un module.
Classe abstraite du superviseur de parallélisme.
virtual bool isMasterIO() const =0
true si l'instance est un gestionnaire maître des entrées/sorties.
virtual bool isParallel() const =0
Retourne true si l'exécution est parallèle.
Informations sur la fabrique d'un service.
Interface des informations d'un service ou d'un module.
virtual String localName() const =0
Partie locale du nom du service.
Interface du gestionnaire de traces.
virtual TraceMessage error()=0
Flot pour un message d'erreur.
virtual TraceMessage info()=0
Flot pour un message d'information.
Sorties des informations internes de Arcane.
void dumpInternalAllInfos()
void dumpArcaneDatabase()
Sauve les informations internes de Arcane dans un fichier json.
static void _buildSharedNull()
static void _destroySharedNull()
static void _destroySingleton()
Détruit le singleton.
static ItemTypeMng * _singleton()
Instance singleton du type.
Implémentation d'une collection d'éléments sous forme de vecteur.
ListEnumeratorT< String > Enumerator
Exception lorsqu'une erreur fatale 'parallèle' est générée.
Encapsulation d'un pointeur qui se détruit automatiquement.
Exception lorsqu'un signal survient.
Chaîne de caractères unicode.
bool null() const
Retourne true si la chaîne est nulle.
const char * localstr() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
bool empty() const
Vrai si la chaîne est vide (nulle ou "")
Exception lorsqu'un timeout survient.
T max(const T &a, const T &b, const T &c)
Retourne le maximum de trois éléments.
Integer toInteger(Real r)
Converti un Int64 en un Integer.
void setDefaultDataMemoryResource(eMemoryResource mem_resource)
Positionne la ressource mémoire utilisée pour l'allocateur mémoire des données.
eMemoryResource getMemoryResourceFromName(const String &name)
Retourne la ressource mémoire par son nom.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.
Collection< IServiceFactoryInfo * > ServiceFactoryInfoCollection
Collection d'informations sur les fabriques de service.
Collection< String > StringCollection
Collection de chaînes de caractères.
void arcaneSignalHandler(int val)
Fonction appelee lorsque le programme est interrompu par le signal 'val'.
Collection< IModuleFactoryInfo * > ModuleFactoryInfoCollection
Collection d'informations sur les fabriques de module.
List< IService * > ServiceList
Tableau de services.
List< String > StringList
Tableau de chaînes de caractères unicode.
double Real
Type représentant un réel.
eMemoryResource
Liste des ressources mémoire disponibles.
@ Unknown
Valeur inconnue ou non initialisée.
@ UnifiedMemory
Alloue en utilisant la mémoire unifiée.
std::int32_t Int32
Type entier signé sur 32 bits.