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

Execution management class. More...

#include <arcane/launcher/ArcaneLauncher.h>

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)

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 Launching a Calculation provides usage examples.

The two execution modes are:

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

◆ 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.

Referenced by init().

◆ 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.

Referenced by run().

◆ 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.

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

◆ 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 Execution 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.

Referenced by init().

◆ 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().

◆ 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().

◆ 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().

◆ 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().

◆ 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.

◆ 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().

◆ 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().

◆ 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.


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