Flow123d  JB_release_tests-c4abd42
application.cc
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file application_base.cc
15  * @brief
16  */
17 
18 #include "application.hh"
19 
20 #include "system/sys_profiler.hh"
21 #include "system/logger_options.hh"
22 #include "system/file_path.hh"
23 #include "system/system.hh"
24 #include <signal.h>
25 #include <iostream>
26 
27 #ifdef FLOW123D_HAVE_PETSC
28 //#include <petsc.h>
29 #include <petscsys.h>
30 #include <petsc/private/petscimpl.h> /* to gain access to the private PetscVFPrintf */
31 #endif
32 
33 #ifdef FLOW123D_HAVE_PERMON
34 #include <permonsys.h>
35 #endif
36 
37 #include <string.h> // for strsignal
38 
39 #include <iostream> // for cout
40 #include <sstream> // for operator<<, endl
41 #include "mpi.h" // for MPI_Comm_size
42 #include "petscerror.h" // for CHKERRQ, Petsc...
43 #include "system/exc_common.hh" // for ExcAssertMsg
44 #include "system/asserts.hh" // for ASSERT_PERMANENT, msg
45 #include "system/logger.hh" // for Logger, operat...
46 #include "system/system.hh" // for SystemInfo
47 
48 
49 
50 
51 /// Function that catches all program signals.
52 /// Note: context variable required by PETSc function PetscPushSignalHandler
53 PetscErrorCode petsc_signal_handler(int signal, FMT_UNUSED void *context)
54 {
55  if (signal == SIGINT) {
56  cout << "SIGINT\n";
57  }
58  if (signal == SIGFPE || // FPE: Floating Point Exception,probably divide by zero
59  signal == SIGILL || // Illegal instruction: Likely due to memory corruption
60  signal == SIGPIPE || // Broken Pipe: Likely while reading or writing to a socket
61  signal == SIGSEGV ) // SEGV: Segmentation Violation, probably memory access out of range
62  {
63  // Signals handled by us.
64  THROW( ExcSignal() << EI_Signal(signal) << EI_SignalName(strsignal(signal)) );
65  } else {
66  return PetscSignalHandlerDefault(signal,(void*)0);
67  }
68  return 0;
69 }
70 
71 void system_signal_handler(int signal) {
72  petsc_signal_handler(signal, nullptr);
73 }
74 
75 
77 : log_filename_(""),
78  signal_handler_off_(false),
79  problem_(nullptr),
80  main_input_filename_(""),
81  //passed_argc_(0),
82  //passed_argv_(0),
83  use_profiler(true),
84  profiler_path(""),
85  yaml_balance_output_(false)
86 
87 {
88  // initialize python stuff if we have
89  // nonstandard python home (release builds)
90  PythonLoader::initialize();
91 
92 }
93 
94 
95 
96 
99 
100 
101 void Application::system_init( MPI_Comm comm, const string &log_filename ) {
102  int ierr;
103 
104  sys_info.comm=comm;
105 
106 
107  //Xio::init(); //Initialize XIO library
108 
109  // TODO : otevrit docasne log file jeste pred ctenim vstupu (kvuli zachyceni chyb), po nacteni dokoncit
110  // inicializaci systemu
111 
112  ierr=MPI_Comm_rank(comm, &(sys_info.my_proc));
113  ierr+=MPI_Comm_size(comm, &(sys_info.n_proc));
115  ASSERT_PERMANENT( ierr == MPI_SUCCESS ).error("MPI not initialized.\n");
116 
117  std::string full_file_name = LoggerOptions::get_instance().log_file_name(log_filename);
118  if ( full_file_name.size() > 0 ) { // else case: empty string > no_log
119  FilePath fp(full_file_name, FilePath::output_file);
121  }
122 
125 }
126 
127 
128 FILE *Application::petsc_output_ =NULL;
129 
130 #ifdef FLOW123D_HAVE_PETSC
131 PetscErrorCode Application::petscvfprintf(FILE *fd, const char format[], va_list Argp) {
132  PetscErrorCode ierr;
133 
134  PetscFunctionBegin;
135  if (fd != stdout && fd != stderr) { /* handle regular files */
136  ierr = PetscVFPrintfDefault(fd,format,Argp); CHKERRQ(ierr);
137  } else {
138  const int buf_size = 65000;
139  char buff[65000];
140  size_t length;
141  ierr = PetscVSNPrintf(buff,buf_size,format,&length,Argp);CHKERRQ(ierr);
142 
143  /* now send buff to whatever stream or whatever you want */
144  fwrite(buff, sizeof(char), length, petsc_output_);
145  }
146  PetscFunctionReturn(0);
147 }
148 #endif
149 
150 
151 void Application::petsc_initialize(int argc, char ** argv) {
152 #ifdef FLOW123D_HAVE_PETSC
153  if (petsc_redirect_file_ != "") {
154  petsc_output_ = fopen(petsc_redirect_file_.c_str(), "w");
155  if (! petsc_output_)
156  THROW(FilePath::ExcFileOpen() << FilePath::EI_Path(petsc_redirect_file_));
157  PetscVFPrintf = this->petscvfprintf;
158  }
159 
160 
161  PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
162  if (! signal_handler_off_) {
163  // PETSc do not catch SIGINT, but someone on the way does, we try to fix it.
164  signal(SIGINT, system_signal_handler);
165  PetscPushSignalHandler(petsc_signal_handler, nullptr);
166  }
167 
168  int mpi_size;
169  MPI_Comm_size(PETSC_COMM_WORLD, &mpi_size);
170  MessageOut() << "MPI size: " << mpi_size << std::endl;
171 #endif
172 }
173 
174 
175 
177 #ifdef FLOW123D_HAVE_PETSC
178  if ( petsc_initialized )
179  {
180  PetscErrorCode ierr=0;
181 
182  ierr = PetscFinalize(); CHKERRQ(ierr);
183 
184  if (petsc_output_) fclose(petsc_output_);
185 
186  petsc_initialized = false;
187 
188  return ierr;
189  }
190 #endif
191 
192  return 0;
193 }
194 
195 
196 void Application::permon_initialize(int argc, char ** argv) {
197 #ifdef FLOW123D_HAVE_PERMON
198  PermonInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
199 #endif
200 }
201 
203 #ifdef FLOW123D_HAVE_PERMON
204  if ( permon_initialized )
205  {
206  PetscErrorCode ierr=0;
207 
208  ierr = PermonFinalize(); CHKERRQ(ierr);
209 
210  permon_initialized = false;
211 
212  return ierr;
213  }
214 #endif
215 
216  return 0;
217 }
218 
219 
220 #include "rev_num.h"
221 
222 /// named version of the program
223 //#define _PROGRAM_VERSION_ "0.0.0"
224 
225 //#ifndef _PROGRAM_REVISION_
226 // #define _PROGRAM_REVISION_ "(unknown revision)"
227 //#endif
228 
229 //#ifndef _PROGRAM_BRANCH_
230 // #define _PROGRAM_BRANCH_ "(unknown branch)"
231 //#endif
232 
233 #ifndef FLOW123D_COMPILER_FLAGS_
234  #define FLOW123D_COMPILER_FLAGS_ "(unknown compiler flags)"
235 #endif
236 
237 
238 namespace it = Input::Type;
239 
241  Input::Type::RevNumData rev_num_data;
242 
243  rev_num_data.version = string(FLOW123D_VERSION_NAME_);
244  rev_num_data.revision = string(FLOW123D_GIT_REVISION_);
245  rev_num_data.branch = string(FLOW123D_GIT_BRANCH_);
246  rev_num_data.url = string(FLOW123D_GIT_URL_);
247 
248  return rev_num_data;
249 }
250 
251 
252 // this should be part of a system class containing all support information
254  static it::Record type = it::Record("Root", "Root record of JSON input for Flow123d.")
255  .declare_key("flow123d_version", it::String(), it::Default::obligatory(),
256  "Version of Flow123d for which the input file was created."
257  "Flow123d only warn about version incompatibility. "
258  "However, external tools may use this information to provide conversion "
259  "of the input file to the structure required by another version of Flow123d.")
261  "Simulation problem to be solved.")
262  .declare_key("pause_after_run", it::Bool(), it::Default("false"),
263  "If true, the program will wait for key press before it terminates.")
264  .close();
265 
266  return type;
267 }
268 
269 
270 
271 
272 
273 
274 
276  // Say Hello
277  // make strings from macros in order to check type
278  Input::Type::RevNumData rev_num_data = get_rev_num_data();
279 
280 
281  string build = string(__DATE__) + ", " + string(__TIME__)
282  + " flags: " + string(FLOW123D_COMPILER_FLAGS_);
283 
284 
285  MessageOut().fmt("This is Flow123d, version {} commit: {}\n",
286  rev_num_data.version, rev_num_data.revision);
287  MessageOut().fmt("Branch: {}\nBuild: {}\nFetch URL: {}\n",
288  rev_num_data.branch, build, rev_num_data.url );
289 
290 }
291 
292 
293 
295  if (main_input_filename_ == "") {
296  cout << "Usage error: The main input file has to be specified through -s parameter.\n\n";
297  cout << program_arguments_desc_ << "\n";
298  exit( exit_failure );
299  }
300 
301  // read main input file
302  FilePath fpath(main_input_filename_, FilePath::FileType::input_file);
303 
304  Input::ReaderToStorage json_reader(fpath, get_input_type() );
306 
307  return root_record;
308 }
309 
310 
311 
312 void Application::parse_cmd_line(const int argc, char ** argv) {
313  namespace po = boost::program_options;
314 
315 
316 
317  // Declare the supported options.
318  po::options_description desc("Allowed options");
319  desc.add_options()
320  ("help", "produce help message")
321  ("solve,s", po::value< string >(), "Main input file to solve.")
322  ("input_dir,i", po::value< string >()->default_value("input"), "Directory for the $INPUT_DIR$ placeholder in the main input file.")
323  ("output_dir,o", po::value< string >()->default_value("output"), "Directory for all produced output files.")
324  ("log,l", po::value< string >()->default_value("flow123"), "Set base name for log files.")
325  ("version", "Display version and build information and exit.")
326  ("no_log", "Turn off logging.")
327  ("no_signal_handler", "Turn off signal handling. Useful for debugging with valgrind.")
328  ("no_profiler,no-profiler", "Turn off profiler output.")
329  ("profiler_path,profiler-path", po::value< string >(), "Path to the profiler file")
330  ("input_format", po::value< string >(), "Writes full structure of the main input file into given file.")
331  ("petsc_redirect", po::value<string>(), "Redirect all PETSc stdout and stderr to given file.")
332  ("yaml_balance", "Redirect balance output to YAML format too (simultaneously with the selected balance output format).");
333 
334 
335 
336  // Can not use positional arguments together with PETSC options.
337  // Use our own solution trying to use the first unrecognized option as the main input file.
338 
339  // parse the command line
340  po::variables_map vm;
341  auto parser = po::basic_command_line_parser<char>(argc, argv)
342  .options(desc)
343  .allow_unregistered();
344  po::parsed_options parsed = parser.run();
345  po::store(parsed, vm);
346  po::notify(vm);
347 
348 
349  // get unknown options
350  vector<string> to_pass_further = po::collect_unrecognized(parsed.options, po::include_positional);
351 
352 
353 
354  /*
355  passed_argc_ = to_pass_further.size();
356  passed_argv_ = new char * [passed_argc_+1];
357 
358  // first copy the program executable in argv[0]
359  int arg_i=0;
360  if (argc > 0) passed_argv_[arg_i++] = xstrcpy( argv[0] );
361 
362  for(int i=0; i < passed_argc_; i++) {
363  passed_argv_[arg_i++] = xstrcpy( to_pass_further[i].c_str() );
364  }
365  passed_argc_ = arg_i;
366  */
367 
368  // possibly turn off profilling
369  if (vm.count("no_profiler")) {
370  use_profiler=false;
371  }
372 
373  if (vm.count("profiler_path")) {
374  profiler_path = vm["profiler_path"].as<string>();
375  }
376 
377  // if there is "help" option
378  if (vm.count("help")) {
379  display_version();
380  cout << endl;
381  cout << "Usage:" << endl;
382  cout << " flow123d -s <main_input>.yaml <other options> <PETSC options>" << endl;
383  cout << " flow123d <main_input>.yaml <other options> <PETSC options>" << endl;
384  cout << desc << "\n";
385  THROW(ExcNoRunOption());
386  }
387 
388 
389  if (vm.count("version")) {
390  display_version();
391  THROW(ExcNoRunOption());
392  }
393 
394 
395 
396  // if there is "input_format" option
397  if (vm.count("input_format")) {
398  // write ist to json file
399  ofstream json_stream;
400  FilePath(vm["input_format"].as<string>(), FilePath::output_file).open_stream(json_stream);
401  // create the root Record
402  it::Record root_type = get_input_type();
403  root_type.finish();
405  json_stream << Input::Type::OutputJSONMachine( root_type, get_rev_num_data() );
406  json_stream.close();
407  THROW(ExcNoRunOption());
408  }
409 
410 
411  if (vm.count("petsc_redirect")) {
412  this->petsc_redirect_file_ = vm["petsc_redirect"].as<string>();
413  }
414 
415  if (vm.count("no_signal_handler")) {
416  this->signal_handler_off_ = true;
417  }
418 
419  // if there is "solve" option
420  string input_filename = "";
421 
422  // check for positional main input file
423  if (to_pass_further.size()) {
424  string file_candidate = to_pass_further[0];
425  if (file_candidate[0] != '-') {
426  // pop the first option
427  input_filename = file_candidate;
428  to_pass_further.erase(to_pass_further.begin());
429  }
430  }
431 
432 
433  if (vm.count("solve")) {
434  input_filename = vm["solve"].as<string>();
435  }
436 
437 
438  if (input_filename == "")
439  THROW(ExcMessage() << EI_Message("Main input file not specified (option -s)."));
440 
441  // preserves output of balance in YAML format
442  if (vm.count("yaml_balance")) Balance::set_yaml_output();
443 
444  string input_dir;
445  string output_dir;
446  if (vm.count("input_dir")) {
447  input_dir = vm["input_dir"].as<string>();
448  }
449  if (vm.count("output_dir")) {
450  output_dir = vm["output_dir"].as<string>();
451  }
452 
453 
454 
455  // assumes working directory "."
456  try {
457  main_input_filename_ = FilePath::set_dirs_from_input(input_filename, input_dir, output_dir );
458  } catch (FilePath::ExcMkdirFail &e) {
459  use_profiler = false; // avoid profiler output
460  throw e;
461  }
462 
463  if (vm.count("log")) {
464  this->log_filename_ = vm["log"].as<string>();
465  }
466 
467  if (vm.count("no_log")) {
468  this->log_filename_="//"; // override; do not open log files
469  }
470 
471  ostringstream tmp_stream(program_arguments_desc_);
472  tmp_stream << desc;
473  // TODO: catch specific exceptions and output usage messages
474 }
475 
476 /**
477  * Contains basic structure of application (initialization, run and finalization).
478  * Method is call after constructor and allows to call virtual methods.
479  */
480 
481 void Application::init(int argc, char ** argv) {
482  // parse our own command line arguments, leave others for PETSc
483 
484  this->parse_cmd_line(argc, argv);
485 
486  string build = string(__DATE__) + ", " + string(__TIME__)
487  + " flags: " + string(FLOW123D_COMPILER_FLAGS_);
488 
489  Input::Type::RevNumData rev_num_data = get_rev_num_data();
490  Profiler::instance()->set_program_info("Flow123d",
491  rev_num_data.version, rev_num_data.branch, rev_num_data.revision, build);
492 
493  //Profiler::instance();
494 
495  armadillo_setup(); // set catching armadillo exceptions and reporting stacktrace
496 
497  this->petsc_initialize(argc, argv);
498  petsc_initialized = true;
499 
500  this->permon_initialize(argc, argv);
501  permon_initialized = true;
502 
503  this->system_init(PETSC_COMM_WORLD, log_filename_); // Petsc, open log, read ini file
504 
505 
506 }
507 
508 
509 
511  START_TIMER("Application::run");
512  display_version();
513 
514  START_TIMER("Read Input");
515  // get main input record handle
516  Input::Record i_rec = read_input();
517  END_TIMER("Read Input");
518 
519  {
520  using namespace Input;
521  // check input file version against the version of executable
522  std::regex version_re("([^.]*)[.]([^.]*)[.]([^.]*)");
523  std::smatch match;
524  std::string version(FLOW123D_VERSION_NAME_);
525  vector<string> ver_fields(3);
526  if ( std::regex_match(version, match, version_re) ) {
527  ver_fields[0]=match[1];
528  ver_fields[1]=match[2];
529  ver_fields[2]=match[3];
530  } else {
531  ASSERT_PERMANENT(0)(version).error("Bad Flow123d version format\n");
532  }
533 
534  std::string input_version = i_rec.val<string>("flow123d_version");
535  vector<string> iver_fields(3);
536  if ( std::regex_match(input_version, match, version_re) ) {
537  iver_fields[0]=match[1];
538  iver_fields[1]=match[2];
539  iver_fields[2]=match[3];
540  } else {
541  THROW( ExcVersionFormat() << EI_InputVersionStr(input_version) );
542  }
543 
544  if ( iver_fields[0] != ver_fields[0] || iver_fields[1] > ver_fields[1] ) {
545  WarningOut().fmt("Input file with version: '{}' is no compatible with the program version: '{}' \n",
546  input_version, version);
547  }
548 
549  // should flow123d wait for pressing "Enter", when simulation is completed
550  sys_info.pause_after_run = i_rec.val<bool>("pause_after_run");
551  // read record with problem configuration
552  Input::AbstractRecord i_problem = i_rec.val<AbstractRecord>("problem");
553 
554  if (i_problem.type() == HC_ExplicitSequential::get_input_type() ) {
555 
556  problem_ = new HC_ExplicitSequential(i_problem);
557 
558  // run simulation
560  } else {
561  THROW( ExcUnknownProblem() );
562  }
563 
564  }
565 
566  this->after_run();
567 }
568 
569 
570 
571 
574  printf("\nPress <ENTER> for closing the window\n");
575  getchar();
576  }
577 }
578 
579 
580 void _transform_profiler_data (const string &json_filepath, const string &output_file_suffix, const string &formatter) {
581  namespace py = pybind11;
582 
583  if (json_filepath == "") return;
584 
585  // grab module and function by importing module profiler_formatter_module.py
586  auto python_module = PythonLoader::load_module_by_name ("profiler.profiler_formatter_module");
587  //
588  // def convert (json_location, output_file, formatter):
589  //
590  auto convert_method = python_module.attr("convert");
591  // execute method with arguments
592  convert_method(json_filepath, (json_filepath + output_file_suffix), formatter);
593 
594 }
595 
596 
597 
598 
599 
601  if (problem_) delete problem_;
602 
603  if (use_profiler) {
604  // TODO: make a static output method that does nothing if the instance does not exist yet.
605  string profiler_json;
606  if (petsc_initialized) {
607  // log profiler data to this stream
608  profiler_json = Profiler::instance()->output(PETSC_COMM_WORLD, profiler_path);
609  } else {
610  profiler_json = Profiler::instance()->output(profiler_path);
611  }
612 
613  // call python script which transforms json file at given location
614  // Profiler::instance()->transform_profiler_data (".csv", "CSVFormatter");
615  _transform_profiler_data (profiler_json, ".txt", "SimpleTableFormatter2");
616 
617  // finally uninitialize
619  }
620 
621  // TODO: have context manager classes for petsc and permon initialization
622  // create a local variable in Application::run or so
623  permon_finalize();
624  petcs_finalize();
625 }
626 
627 
628 
629 
PetscErrorCode petsc_signal_handler(int signal, FMT_UNUSED void *context)
Definition: application.cc:53
void _transform_profiler_data(const string &json_filepath, const string &output_file_suffix, const string &formatter)
Definition: application.cc:580
void system_signal_handler(int signal)
Definition: application.cc:71
#define FLOW123D_COMPILER_FLAGS_
named version of the program
Definition: application.cc:234
Input::Type::RevNumData get_rev_num_data()
Definition: application.cc:240
void armadillo_setup()
Definitions of ASSERTS.
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Definition: asserts.hh:348
static bool permon_initialized
Definition: application.hh:95
string main_input_filename_
filename of main input file
Definition: application.hh:221
Input::Record read_input()
Definition: application.cc:294
static FILE * petsc_output_
File handler for redirecting PETSc output.
Definition: application.hh:208
static const int exit_failure
Definition: application.hh:91
string program_arguments_desc_
Description of possible command line arguments.
Definition: application.hh:227
string log_filename_
Definition: application.hh:201
void init(int argc, char **argv)
Definition: application.cc:481
int petcs_finalize()
Definition: application.cc:176
void display_version()
Definition: application.cc:275
~Application()
Destructor.
Definition: application.cc:600
void system_init(MPI_Comm comm, const string &log_filename)
Definition: application.cc:101
bool use_profiler
If true, we do output of profiling information.
Definition: application.hh:230
string profiler_path
location of the profiler report file
Definition: application.hh:233
void permon_initialize(int argc, char **argv)
Definition: application.cc:196
static Input::Type::Record & get_input_type()
Root of the Input::Type tree. Description of whole input structure.
Definition: application.cc:253
string petsc_redirect_file_
Definition: application.hh:205
void petsc_initialize(int argc, char **argv)
Definition: application.cc:151
Input::Record root_record
root input record
Definition: application.hh:239
void after_run()
Definition: application.cc:572
void parse_cmd_line(const int argc, char **argv)
Definition: application.cc:312
HC_ExplicitSequential * problem_
Get version of program and other base data from rev_num.h and store them to map.
Definition: application.hh:218
static bool petsc_initialized
Definition: application.hh:94
int permon_finalize()
Definition: application.cc:202
bool signal_handler_off_
Turn off signal handling useful to debug with valgrind.
Definition: application.hh:211
static void set_yaml_output()
Set global variable to output balance files into YAML format (in addition to the table format).
Definition: balance.cc:66
static Input::Type::Abstract & get_input_type()
Dedicated class for storing path to input and output files.
Definition: file_path.hh:54
@ output_file
Definition: file_path.hh:69
string filename() const
Definition: file_path.cc:188
string parent_path() const
Definition: file_path.cc:183
void open_stream(Stream &stream) const
Definition: file_path.cc:211
static string set_dirs_from_input(const string main_yaml, const string input, const string output)
Method for set input and output directories.
Definition: file_path.cc:137
Class for solution of steady or unsteady flow with sequentially coupled explicit transport.
static const Input::Type::Record & get_input_type()
Accessor to the polymorphic input data of a type given by an AbstracRecord object.
Definition: accessors.hh:458
Reader for (slightly) modified input files.
T get_root_interface() const
Returns the root accessor.
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
const Ret val(const string &key) const
Class for declaration of the input of type Bool.
Definition: type_base.hh:452
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
static Default obligatory()
The factory function to make an empty default value which is obligatory.
Definition: type_record.hh:110
Class for create JSON machine readable documentation.
Definition: type_output.hh:252
Record type proxy class.
Definition: type_record.hh:182
FinishStatus finish(FinishStatus finish_type=FinishStatus::regular_) override
Finish declaration of the Record type.
Definition: type_record.cc:243
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:304
Record & declare_key(const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
Declares a new key of the Record.
Definition: type_record.cc:503
Class for declaration of the input data that are in string format.
Definition: type_base.hh:582
static void delete_unfinished_types()
Finishes and marks all types registered in type repositories and unused in IST.
Definition: type_base.cc:107
void set_stream(std::string abs_path)
Set init_ flag.
static LoggerOptions & get_instance()
Getter of singleton instance object.
void set_mpi_rank(int mpi_rank)
Set rank of actual process.
std::string log_file_name(std::string log_file_base)
Create unique log file name.
static void uninitialize()
void output(MPI_Comm, ostream &)
static Profiler * instance(bool clear=false)
void set_program_info(string, string, string, string, string)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Definition: exceptions.hh:53
#define WarningOut()
Macro defining 'warning' record of log.
Definition: logger.hh:278
#define MessageOut()
Macro defining 'message' record of log.
Definition: logger.hh:275
manipulators::Array< T, Delim > format(T const &deduce, Delim delim=", ")
Definition: logger.hh:325
#define MPI_SUCCESS
Definition: mpi.c:17
#define MPI_Comm_size
Definition: mpi.h:235
int MPI_Comm
Definition: mpi.h:141
#define MPI_Comm_rank
Definition: mpi.h:236
Abstract linear system class.
Definition: balance.hh:40
void printf(BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)
Definition: printf.h:444
#define FMT_UNUSED
Definition: posix.h:75
Stores version of program and other base data of application.
Definition: type_output.hh:44
std::string branch
Actual branch of application.
Definition: type_output.hh:47
std::string url
Url of application.
Definition: type_output.hh:48
std::string revision
Actual revision of application.
Definition: type_output.hh:46
std::string version
Actual version of application.
Definition: type_output.hh:45
int my_proc
Definition: system.hh:78
int n_proc
Definition: system.hh:77
MPI_Comm comm
Definition: system.hh:80
int pause_after_run
Definition: system.hh:74
int verbosity
Definition: system.hh:73
#define END_TIMER(tag)
Ends a timer with specified tag.
#define START_TIMER(tag)
Starts a timer with specified tag.
SystemInfo sys_info
Definition: system.cc:41