Class OptimizationApplication¶
Defined in File optimizationApplication.h
Class Documentation¶
-
class
parpe
::
OptimizationApplication
¶ The OptimizationApplication class parses command line arguments, initializes MPI if required, opens data and results files and starts an optimization.
Public Functions
-
OptimizationApplication
() = default¶
-
virtual
~OptimizationApplication
()¶
-
virtual void
initProblem
(std::string inFileArgument, std::string outFileArgument) = 0¶ User-provided problem initialization. Must set OptimizationApplication::problem, OptimizationApplication::multiStartOptimization and should set OptimizationApplication::resultWriter.
- Parameters
inFileArgument
:outFileArgument
:
-
int
run
(int argc, char **argv)¶ Start the optimization run. Must only be called once. Initializes MPI if not already done. Must be called before any other functions.
- Return
status code; 0 on success
-
virtual void
runMaster
()¶ This is run by the MPI rank 0 process when started with multiple processes.
-
virtual void
runSingleProcess
()¶ Code to be run if the application is running on only 1 process.
Protected Types
Protected Functions
-
virtual void
finalizeTiming
(double wallTimeSeconds, double cpuTimeSeconds)¶ Receives and writes the total programm runtime.
- Parameters
begin
:
-
std::string
processResultFilenameCommandLineArgument
(const char *commandLineArg)¶ processResultFilenameCommandLineArgument
- Return
Result file name
- Parameters
commandLineArg
:
-
bool
isMaster
()¶ Are we running with MPI and are we master process?
- Return
-
bool
isWorker
()¶ Are we running with MPI and are we a worker?
- Return
-
virtual int
parseCliOptionsPreMpiInit
(int argc, char **argv)¶ Parse command line options before MPI_INIT is potentially called.
Used e.g. to print usage information without first initialization MPI.
Argv may contain extra MPI arguments.
- Return
- Parameters
argc
:argv
:
-
virtual int
parseCliOptionsPostMpiInit
(int argc, char **argv)¶ Parse command line options after MPI_Init is called.
Any MPI-related CLI arguments will be removed here.
- Return
- Parameters
argc
:argv
:
-
virtual void
printUsage
(char *const argZero)¶ Print CLI usage.
- Parameters
argZero
:
-
virtual void
logParPEVersion
(const H5::H5File &file) const¶
Protected Attributes
-
const char *
shortOptions
= "dhvmt:o:s:"¶
-
struct option const
longOptions
[9] = {{"debug", no_argument, nullptr, 'd'}, {"print-worklist", no_argument, nullptr, 'p'}, {"help", no_argument, nullptr, 'h'}, {"version", no_argument, nullptr, 'v'}, {"mpi", no_argument, nullptr, 'm'}, {"task", required_argument, nullptr, 't'}, {"outfile-prefix", required_argument, nullptr, 'o'}, {"first-start-idx", required_argument, nullptr, 's'}, {nullptr, 0, nullptr, 0}}¶
-
std::string
dataFileName
¶
-
std::string
resultFileName
¶
-
int
first_start_idx
= {0}¶
-
std::unique_ptr<MultiStartOptimizationProblem>
multiStartOptimizationProblem
¶
-
std::unique_ptr<OptimizationProblem>
problem
¶
-
H5::H5File
h5File
= 0¶
-
OperationType
operationType
= OperationType::parameterEstimation¶
-
LoadBalancerMaster
loadBalancer
¶
-
bool
withMPI
= false¶
Protected Static Functions
-
static void
initMPI
(int *argc, char ***argv)¶ Initialize MPI.
- Parameters
argc
:argv
:
-