21 XPACCParallelProgramType()
30 XPACCParallelProgramType(nargs,args)
40 this->_command_line.Copy(comline);
41 this->Init(_command_line.ProgramName(),incomm);
52 ErrOut(
"Failed to initialize.\n");
53 ErrOut(CommandLine().ErrorReport()+std::string(
"\n"));
54 ErrOut(
"Use -h,--help for usage help.\n\n");
55 ErrOut(CommandLine().ShortUsage()+std::string(
"\n"));
58 if(!CommandLine().GetOption(
'h').empty()){
59 StdOut(CommandLine().LongUsage());
62 std::string applicationName(CommandLine().ProgramName());
70 std::string sverb(CommandLine().GetOption(
'v'));
77 int nZeros = std::log10((
double)nproc);
78 std::istringstream Istr(sverb);
81 SetVerbLevel(verbLevel);
84 outFilePtr =
new std::ofstream;
85 std::ostringstream outFileNameStream;
86 outFileNameStream << applicationName <<
"_";
87 for(
int i = nZeros;i > 0;i--){
88 int numRanks = std::pow((
double)10,(
double)i);
90 outFileNameStream <<
"0";
93 SetErrStream(std::cerr);
94 outFileNameStream << rank;
95 outFileName.assign(outFileNameStream.str());
96 outFilePtr->open(outFileNameStream.str().c_str());
98 globalCommunicator.SetErr(1);
101 if(globalCommunicator.Check()){
103 ErrOut(
"Unable to open output on all processors.\n");
105 }
else if(rank > 0) {
106 SetOutStream(*outFilePtr);
108 SetDebugStream(OutStream());
109 SetDebugLevel(verbLevel - 2);
114 std::string sprof(CommandLine().GetOption(
'p'));
116 DisableProfilingBarriers();
118 if(sprof ==
".true.")
121 std::istringstream Istr(sprof);
129 EnableProfilingBarriers();
134 std::string sdebug(CommandLine().GetOption(
'd'));
136 if(sdebug ==
".true.")
139 std::istringstream Istr(sdebug);
143 SetDebugLevel(debugLevel);
164 SetOutStream(std::cout);
174 if(XPACCParallelProgramType::Finalize()){
175 ErrOut(
"Failed to finalize.\n");
177 DumpErrors(ErrStream());
184 template<
typename ProgramType>
188 if(mainProgram.Initialize()){
191 std::string programName(mainProgram.CommandLine().ProgramName());
193 if(mainProgram.Run()){
197 if(mainProgram.Finalize()){
virtual int Run()
This function implements the main function executed by the program.
int VerbLevel() const
Returns verbosity level.
int ndiv
Number of partitions for domain.
int verblevel
Verbosity level.
testing_parallel_program()
Default constructor.
testing_parallel_program(int nargs, char **args)
Constructor designed to take all commandline args.
int XPACCMainDriver(int argc, char *argv[])
virtual int Initialize()
Populates native data structures from commandline.
std::string outFileName
Name of file for output.
Main encapsulation of MPI.
ix::global::Program< ParallelGlobalType, CommandLineType > ParallelProgramType
ix::global::ParallelGlobalObj< CommType, std::string, int, ProfilerType > ParallelGlobalType
ix::comm::CommunicatorObject CommType
std::ofstream * outFilePtr
Output file stream object for output.
global::Program< Global, command_line > ProgramType
int Initialize(base &stencilSet, int interiorOrder)
Initialize the sbp::base stencilset with the SBP operator of given order.
testing_parallel_program(XPACCCommandLineType &comline, XPACCCommType &incomm)
Constructor designed to take all commandline args.
virtual ~testing_parallel_program()
Destructor.