Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::ArcaneLauncher Class Reference

Execution management class. More...

#include <arcane/launcher/ArcaneLauncher.h>

Collaboration diagram for Arcane::ArcaneLauncher:

Static Public Member Functions

static void init (const CommandLineArguments &args)
 Positions information from command-line arguments and initializes the launcher.
static bool isInitialized ()
 Indicates if init() has already been called.
static int run ()
 Entry point of the executable in Arcane.
static int run (std::function< int(DirectExecutionContext &)> func)
 Direct execution.
static int run (std::function< int(DirectSubDomainExecutionContext &)> func)
 Direct execution with subdomain creation.
static void setDefaultMainFactory (IMainFactory *mf)
 Positions the default factory for creating the different managers.
static ApplicationInfoapplicationInfo ()
 Application information.
static ApplicationBuildInfoapplicationBuildInfo ()
 Application execution parameter information.
static DotNetRuntimeInitialisationInfodotNetRuntimeInitialisationInfo ()
 Information for '.Net' runtime initialization.
static AcceleratorRuntimeInitialisationInfoacceleratorRuntimeInitialisationInfo ()
 Information for accelerator initialization.
static String getExeDirectory ()
 Full name of the directory where the executable is located.
static StandaloneAcceleratorMng createStandaloneAcceleratorMng ()
 Creates a standalone implementation to manage accelerators.
static StandaloneSubDomain createStandaloneSubDomain (const String &case_file_name)
 Creates a standalone implementation to manage a subdomain.
static bool needHelp ()
 Requests help with the "--help" or "-h" option.
static bool printHelp ()
 Display of generic Arcane help.
static int runDirect (std::function< int(IDirectExecutionContext *)> func)
static void setCommandLineArguments (const CommandLineArguments &args)

Static Private Member Functions

static void _initStandalone ()
static void _notifyRemoveStandaloneSubDomain ()

Private Attributes

friend StandaloneSubDomain

Detailed Description

Execution management class.

There are two modes of using Arcane: classic mode and standalone mode.

Regardless of the mode chosen, the first thing to do is initialize Arcane by setting the arguments via the init() method, because certain command-line parameters are used to populate the properties of applicationInfo() and dotNetRuntimeInitialisationInfo().

The page arcanedoc_execution_launcher provides usage examples.

The two execution modes are:

  • classic mode, which uses a time loop, and thus the entire execution will be managed by Arcane. In this mode, you simply call the run() method without arguments.
  • standalone mode, which allows Arcane to be used as a library. For this mode, you must use the createStandaloneSubDomain() or createStandaloneAcceleratorMng() method. The page arcanedoc_execution_direct_execution describes how to use this mechanism.

The classic usage is as follows:

int main(int* argc,char* argv[])
{
auto& app_info = ArcaneLauncher::applicationInfo();
app_info.setCodeName("MyCode");
app_info.setCodeVersion(VersionInfo(1,0,0));
}
static int run()
Entry point of the executable in Arcane.
static void init(const CommandLineArguments &args)
Positions information from command-line arguments and initializes the launcher.
static ApplicationInfo & applicationInfo()
Application information.
Information about a version.
Definition VersionInfo.h:47

Definition at line 81 of file ArcaneLauncher.h.

Member Function Documentation

◆ _initStandalone()

void Arcane::ArcaneLauncher::_initStandalone ( )
staticprivate

Definition at line 402 of file ArcaneLauncher.cc.

◆ _notifyRemoveStandaloneSubDomain()

void Arcane::ArcaneLauncher::_notifyRemoveStandaloneSubDomain ( )
staticprivate

Definition at line 437 of file ArcaneLauncher.cc.

◆ acceleratorRuntimeInitialisationInfo()

AcceleratorRuntimeInitialisationInfo & Arcane::ArcaneLauncher::acceleratorRuntimeInitialisationInfo ( )
static

Information for accelerator initialization.

To be taken into account, this information must be modified before calling run() or rundDirect().

Definition at line 151 of file ArcaneLauncher.cc.

References Arcane::ArcaneMain::defaultAcceleratorRuntimeInitialisationInfo().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applicationBuildInfo()

ApplicationBuildInfo & Arcane::ArcaneLauncher::applicationBuildInfo ( )
static

Application execution parameter information.

This method allows retrieving the ApplicationBuildInfo instance that will be used when calling run().

To be taken into account, this information must be modified before calling run() or runDirect().

Definition at line 160 of file ArcaneLauncher.cc.

References Arcane::ArcaneMain::defaultApplicationBuildInfo().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applicationInfo()

ApplicationInfo & Arcane::ArcaneLauncher::applicationInfo ( )
static

Application information.

This method allows retrieving the ApplicationInfo instance that will be used when calling run().

To be taken into account, this information must be modified before calling run() or runDirect().

Definition at line 133 of file ArcaneLauncher.cc.

References Arcane::ArcaneMain::defaultApplicationInfo().

Referenced by init(), needHelp(), and printHelp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createStandaloneAcceleratorMng()

StandaloneAcceleratorMng Arcane::ArcaneLauncher::createStandaloneAcceleratorMng ( )
static

Creates a standalone implementation to manage accelerators.

You must call init() before calling this method. The choice of runtime (Arcane::Accelerator::eExecutionPolicy) is determined by the arguments used when calling init() or specified via acceleratorRuntimeInitialisationInfo() (see arcanedoc_parallel_accelerator_exec for more information)

Definition at line 415 of file ArcaneLauncher.cc.

◆ createStandaloneSubDomain()

StandaloneSubDomain Arcane::ArcaneLauncher::createStandaloneSubDomain ( const String & case_file_name)
static

Creates a standalone implementation to manage a subdomain.

Only one instance of StandaloneSubDomain is allowed. Calling this method more than once generates an exception.

You must call init() before calling this method.

If this method is called, you must not call other ArcaneLauncher execution methods (for example ArcaneLauncher::run()).

case_file_name is the name of the file containing the dataset. If null, there is no dataset.

Definition at line 425 of file ArcaneLauncher.cc.

◆ dotNetRuntimeInitialisationInfo()

DotNetRuntimeInitialisationInfo & Arcane::ArcaneLauncher::dotNetRuntimeInitialisationInfo ( )
static

Information for '.Net' runtime initialization.

To be taken into account, this information must be modified before calling run() or rundDirect().

Definition at line 142 of file ArcaneLauncher.cc.

References Arcane::ArcaneMain::defaultDotNetRuntimeInitialisationInfo().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExeDirectory()

String Arcane::ArcaneLauncher::getExeDirectory ( )
static

Full name of the directory where the executable is located.

Definition at line 169 of file ArcaneLauncher.cc.

References Arcane::platform::getExeFullPath(), and Arcane::platform::getFileDirName().

Here is the call graph for this function:

◆ init()

void Arcane::ArcaneLauncher::init ( const CommandLineArguments & args)
static

Positions information from command-line arguments and initializes the launcher.

This method fills the uninitialized values of applicationInfo() and dotNetRuntimeInitialisationInfo() with the parameters specified in args.

This method must only be called once. Additional calls generate a FatalErrorException.

Definition at line 349 of file ArcaneLauncher.cc.

References acceleratorRuntimeInitialisationInfo(), applicationInfo(), ARCANE_FATAL, Arcane::ApplicationInfo::commandLineArguments(), dotNetRuntimeInitialisationInfo(), Arcane::String::empty(), Arcane::CommandLineArguments::getParameter(), Arcane::CommandLineArguments::parameters(), and Arcane::TaskFactory::setDefaultParallelLoopOptions().

Referenced by setCommandLineArguments().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInitialized()

bool Arcane::ArcaneLauncher::isInitialized ( )
static

Indicates if init() has already been called.

Definition at line 384 of file ArcaneLauncher.cc.

◆ needHelp()

bool Arcane::ArcaneLauncher::needHelp ( )
static

Requests help with the "--help" or "-h" option.

Method allowing to know if the user requested help with the "--help" or "-h" option.

Returns
true if help was requested.

Definition at line 445 of file ArcaneLauncher.cc.

References applicationInfo(), Arcane::ApplicationInfo::commandLineArguments(), and Arcane::CommandLineArguments::needHelp().

Referenced by printHelp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printHelp()

bool Arcane::ArcaneLauncher::printHelp ( )
static

Display of generic Arcane help.

Method allowing to display generic Arcane help if the user requested it with the "--help" or "-h" option.

Returns
true if help was requested.

Definition at line 454 of file ArcaneLauncher.cc.

References applicationInfo(), and needHelp().

Here is the call graph for this function:

◆ run() [1/3]

int Arcane::ArcaneLauncher::run ( )
static

Entry point of the executable in Arcane.

This method initializes the application, reads the dataset, and executes the code according to the time loop specified in the dataset.

Return values
0upon success
Returns
a value different from 0 in case of error.

Definition at line 124 of file ArcaneLauncher.cc.

References Arcane::ArcaneMain::run().

Here is the call graph for this function:

◆ run() [2/3]

int Arcane::ArcaneLauncher::run ( std::function< int(DirectExecutionContext &)> func)
static

Direct execution.

Initializes the application and calls the function func after initialization. This method must only be called in sequential execution.

Definition at line 245 of file ArcaneLauncher.cc.

◆ run() [3/3]

int Arcane::ArcaneLauncher::run ( std::function< int(DirectSubDomainExecutionContext &)> func)
static

Direct execution with subdomain creation.

Initializes the application and creates the subdomain(s) and calls the function func afterward. This method allows executing code without going through the time loop mechanisms. This method automatically manages the creation of subdomains based on launch parameters (MPI parallel execution, multithreading, ...).

Definition at line 302 of file ArcaneLauncher.cc.

References applicationBuildInfo(), Arcane::ApplicationBuildInfo::configFileName(), Arcane::String::empty(), and Arcane::ApplicationBuildInfo::setConfigFileName().

Here is the call graph for this function:

◆ runDirect()

int Arcane::ArcaneLauncher::runDirect ( std::function< int(IDirectExecutionContext *)> func)
static
Deprecated

Definition at line 221 of file ArcaneLauncher.cc.

◆ setCommandLineArguments()

void Arcane::ArcaneLauncher::setCommandLineArguments ( const CommandLineArguments & args)
inlinestatic
Deprecated

Definition at line 244 of file ArcaneLauncher.h.

References init(), and setCommandLineArguments().

Referenced by setCommandLineArguments().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDefaultMainFactory()

void Arcane::ArcaneLauncher::setDefaultMainFactory ( IMainFactory * mf)
static

Positions the default factory for creating the different managers.

This method must be called before run(). The instance passed as an argument must remain valid during the execution of run(). The caller remains the owner of the instance.

Definition at line 393 of file ArcaneLauncher.cc.

References Arcane::ArcaneMain::setDefaultMainFactory().

Here is the call graph for this function:

Member Data Documentation

◆ StandaloneSubDomain

friend Arcane::ArcaneLauncher::StandaloneSubDomain
private

Definition at line 83 of file ArcaneLauncher.h.


The documentation for this class was generated from the following files: