Flow123d  DF_profiler_memory_monitor-0108f36
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  memory_monitoring(false),
85  profiler_path(""),
86  yaml_balance_output_(false)
87 
88 {
89  // initialize python stuff if we have
90  // nonstandard python home (release builds)
91  PythonLoader::initialize();
92 
93 }
94 
95 
96 
97 
100 
101 
102 void Application::system_init( MPI_Comm comm, const string &log_filename ) {
103  int ierr;
104 
105  sys_info.comm=comm;
106 
107 
108  //Xio::init(); //Initialize XIO library
109 
110  // TODO : otevrit docasne log file jeste pred ctenim vstupu (kvuli zachyceni chyb), po nacteni dokoncit
111  // inicializaci systemu
112 
113  ierr=MPI_Comm_rank(comm, &(sys_info.my_proc));
114  ierr+=MPI_Comm_size(comm, &(sys_info.n_proc));
116  ASSERT_PERMANENT( ierr == MPI_SUCCESS ).error("MPI not initialized.\n");
117 
118  // determine logfile name or switch it off
119  stringstream log_name;
120 
121  if ( log_filename == "//" ) {
122  // -l option without given name -> turn logging off
123  sys_info.log=NULL;
125  } else {
126  // construct full log name
127  //log_name << log_filename << "." << sys_info.my_proc << ".old.log";
128 
129  //sys_info.log_fname = FilePath(log_name.str(), FilePath::output_file);
130  //sys_info.log=xfopen(sys_info.log_fname.c_str(),"wt");
131 
133  }
134 
137 }
138 
139 
140 FILE *Application::petsc_output_ =NULL;
141 
142 #ifdef FLOW123D_HAVE_PETSC
143 PetscErrorCode Application::petscvfprintf(FILE *fd, const char format[], va_list Argp) {
144  PetscErrorCode ierr;
145 
146  PetscFunctionBegin;
147  if (fd != stdout && fd != stderr) { /* handle regular files */
148  ierr = PetscVFPrintfDefault(fd,format,Argp); CHKERRQ(ierr);
149  } else {
150  const int buf_size = 65000;
151  char buff[65000];
152  size_t length;
153  ierr = PetscVSNPrintf(buff,buf_size,format,&length,Argp);CHKERRQ(ierr);
154 
155  /* now send buff to whatever stream or whatever you want */
156  fwrite(buff, sizeof(char), length, petsc_output_);
157  }
158  PetscFunctionReturn(0);
159 }
160 #endif
161 
162 
163 void Application::petsc_initialize(int argc, char ** argv) {
164 #ifdef FLOW123D_HAVE_PETSC
165  if (petsc_redirect_file_ != "") {
166  petsc_output_ = fopen(petsc_redirect_file_.c_str(), "w");
167  if (! petsc_output_)
168  THROW(FilePath::ExcFileOpen() << FilePath::EI_Path(petsc_redirect_file_));
169  PetscVFPrintf = this->petscvfprintf;
170  }
171 
172 
173  PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
174  if (! signal_handler_off_) {
175  // PETSc do not catch SIGINT, but someone on the way does, we try to fix it.
176  signal(SIGINT, system_signal_handler);
177  PetscPushSignalHandler(petsc_signal_handler, nullptr);
178  }
179 
180  int mpi_size;
181  MPI_Comm_size(PETSC_COMM_WORLD, &mpi_size);
182  MessageOut() << "MPI size: " << mpi_size << std::endl;
183 #endif
184 }
185 
186 
187 
189 #ifdef FLOW123D_HAVE_PETSC
190  if ( petsc_initialized )
191  {
192  PetscErrorCode ierr=0;
193 
194  ierr = PetscFinalize(); CHKERRQ(ierr);
195 
196  if (petsc_output_) fclose(petsc_output_);
197 
198  petsc_initialized = false;
199 
200  return ierr;
201  }
202 #endif
203 
204  return 0;
205 }
206 
207 
208 void Application::permon_initialize(int argc, char ** argv) {
209 #ifdef FLOW123D_HAVE_PERMON
210  PermonInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
211 #endif
212 }
213 
215 #ifdef FLOW123D_HAVE_PERMON
216  if ( permon_initialized )
217  {
218  PetscErrorCode ierr=0;
219 
220  ierr = PermonFinalize(); CHKERRQ(ierr);
221 
222  permon_initialized = false;
223 
224  return ierr;
225  }
226 #endif
227 
228  return 0;
229 }
230 
231 
232 #include "rev_num.h"
233 
234 /// named version of the program
235 //#define _PROGRAM_VERSION_ "0.0.0"
236 
237 //#ifndef _PROGRAM_REVISION_
238 // #define _PROGRAM_REVISION_ "(unknown revision)"
239 //#endif
240 
241 //#ifndef _PROGRAM_BRANCH_
242 // #define _PROGRAM_BRANCH_ "(unknown branch)"
243 //#endif
244 
245 #ifndef FLOW123D_COMPILER_FLAGS_
246  #define FLOW123D_COMPILER_FLAGS_ "(unknown compiler flags)"
247 #endif
248 
249 
250 namespace it = Input::Type;
251 
253  Input::Type::RevNumData rev_num_data;
254 
255  rev_num_data.version = string(FLOW123D_VERSION_NAME_);
256  rev_num_data.revision = string(FLOW123D_GIT_REVISION_);
257  rev_num_data.branch = string(FLOW123D_GIT_BRANCH_);
258  rev_num_data.url = string(FLOW123D_GIT_URL_);
259 
260  return rev_num_data;
261 }
262 
263 
264 // this should be part of a system class containing all support information
266  static it::Record type = it::Record("Root", "Root record of JSON input for Flow123d.")
267  .declare_key("flow123d_version", it::String(), it::Default::obligatory(),
268  "Version of Flow123d for which the input file was created."
269  "Flow123d only warn about version incompatibility. "
270  "However, external tools may use this information to provide conversion "
271  "of the input file to the structure required by another version of Flow123d.")
273  "Simulation problem to be solved.")
274  .declare_key("pause_after_run", it::Bool(), it::Default("false"),
275  "If true, the program will wait for key press before it terminates.")
276  .close();
277 
278  return type;
279 }
280 
281 
282 
283 
284 
285 
286 
288  // Say Hello
289  // make strings from macros in order to check type
290  Input::Type::RevNumData rev_num_data = get_rev_num_data();
291 
292 
293  string build = string(__DATE__) + ", " + string(__TIME__)
294  + " flags: " + string(FLOW123D_COMPILER_FLAGS_);
295 
296 
297  MessageOut().fmt("This is Flow123d, version {} commit: {}\n",
298  rev_num_data.version, rev_num_data.revision);
299  MessageOut().fmt("Branch: {}\nBuild: {}\nFetch URL: {}\n",
300  rev_num_data.branch, build, rev_num_data.url );
301 
302 }
303 
304 
305 
307  if (main_input_filename_ == "") {
308  cout << "Usage error: The main input file has to be specified through -s parameter.\n\n";
309  cout << program_arguments_desc_ << "\n";
310  exit( exit_failure );
311  }
312 
313  // read main input file
314  FilePath fpath(main_input_filename_, FilePath::FileType::input_file);
315 
316  Input::ReaderToStorage json_reader(fpath, get_input_type() );
318 
319  return root_record;
320 }
321 
322 
323 
324 void Application::parse_cmd_line(const int argc, char ** argv) {
325  namespace po = boost::program_options;
326 
327 
328 
329  // Declare the supported options.
330  po::options_description desc("Allowed options");
331  desc.add_options()
332  ("help", "produce help message")
333  ("solve,s", po::value< string >(), "Main input file to solve.")
334  ("input_dir,i", po::value< string >()->default_value("input"), "Directory for the $INPUT_DIR$ placeholder in the main input file.")
335  ("output_dir,o", po::value< string >()->default_value("output"), "Directory for all produced output files.")
336  ("log,l", po::value< string >()->default_value("flow123"), "Set base name for log files.")
337  ("version", "Display version and build information and exit.")
338  ("no_log", "Turn off logging.")
339  ("no_signal_handler", "Turn off signal handling. Useful for debugging with valgrind.")
340  ("no_profiler,no-profiler", "Turn off profiler output.")
341  ("profiler_path,profiler-path", po::value< string >(), "Path to the profiler file")
342  ("memory_monitoring,memory-monitoring", "Switch on memory monitoring.")
343  ("input_format", po::value< string >(), "Writes full structure of the main input file into given file.")
344  ("petsc_redirect", po::value<string>(), "Redirect all PETSc stdout and stderr to given file.")
345  ("yaml_balance", "Redirect balance output to YAML format too (simultaneously with the selected balance output format).");
346 
347 
348 
349  // Can not use positional arguments together with PETSC options.
350  // Use our own solution trying to use the first unrecognized option as the main input file.
351 
352  // parse the command line
353  po::variables_map vm;
354  auto parser = po::basic_command_line_parser<char>(argc, argv)
355  .options(desc)
356  .allow_unregistered();
357  po::parsed_options parsed = parser.run();
358  po::store(parsed, vm);
359  po::notify(vm);
360 
361 
362  // get unknown options
363  vector<string> to_pass_further = po::collect_unrecognized(parsed.options, po::include_positional);
364 
365 
366 
367  /*
368  passed_argc_ = to_pass_further.size();
369  passed_argv_ = new char * [passed_argc_+1];
370 
371  // first copy the program executable in argv[0]
372  int arg_i=0;
373  if (argc > 0) passed_argv_[arg_i++] = xstrcpy( argv[0] );
374 
375  for(int i=0; i < passed_argc_; i++) {
376  passed_argv_[arg_i++] = xstrcpy( to_pass_further[i].c_str() );
377  }
378  passed_argc_ = arg_i;
379  */
380 
381  // possibly turn off profilling
382  if (vm.count("no_profiler")) {
383  use_profiler=false;
384  }
385 
386  if (vm.count("profiler_path")) {
387  profiler_path = vm["profiler_path"].as<string>();
388  }
389 
390  if (vm.count("memory_monitoring")) {
391  memory_monitoring=true;
392  }
393 
394  // if there is "help" option
395  if (vm.count("help")) {
396  display_version();
397  cout << endl;
398  cout << "Usage:" << endl;
399  cout << " flow123d -s <main_input>.yaml <other options> <PETSC options>" << endl;
400  cout << " flow123d <main_input>.yaml <other options> <PETSC options>" << endl;
401  cout << desc << "\n";
402  THROW(ExcNoRunOption());
403  }
404 
405 
406  if (vm.count("version")) {
407  display_version();
408  THROW(ExcNoRunOption());
409  }
410 
411 
412 
413  // if there is "input_format" option
414  if (vm.count("input_format")) {
415  // write ist to json file
416  ofstream json_stream;
417  FilePath(vm["input_format"].as<string>(), FilePath::output_file).open_stream(json_stream);
418  // create the root Record
419  it::Record root_type = get_input_type();
420  root_type.finish();
422  json_stream << Input::Type::OutputJSONMachine( root_type, get_rev_num_data() );
423  json_stream.close();
424  THROW(ExcNoRunOption());
425  }
426 
427 
428  if (vm.count("petsc_redirect")) {
429  this->petsc_redirect_file_ = vm["petsc_redirect"].as<string>();
430  }
431 
432  if (vm.count("no_signal_handler")) {
433  this->signal_handler_off_ = true;
434  }
435 
436  // if there is "solve" option
437  string input_filename = "";
438 
439  // check for positional main input file
440  if (to_pass_further.size()) {
441  string file_candidate = to_pass_further[0];
442  if (file_candidate[0] != '-') {
443  // pop the first option
444  input_filename = file_candidate;
445  to_pass_further.erase(to_pass_further.begin());
446  }
447  }
448 
449 
450  if (vm.count("solve")) {
451  input_filename = vm["solve"].as<string>();
452  }
453 
454 
455  if (input_filename == "")
456  THROW(ExcMessage() << EI_Message("Main input file not specified (option -s)."));
457 
458  // preserves output of balance in YAML format
459  if (vm.count("yaml_balance")) Balance::set_yaml_output();
460 
461  string input_dir;
462  string output_dir;
463  if (vm.count("input_dir")) {
464  input_dir = vm["input_dir"].as<string>();
465  }
466  if (vm.count("output_dir")) {
467  output_dir = vm["output_dir"].as<string>();
468  }
469 
470 
471 
472  // assumes working directory "."
473  try {
474  main_input_filename_ = FilePath::set_dirs_from_input(input_filename, input_dir, output_dir );
475  } catch (FilePath::ExcMkdirFail &e) {
476  use_profiler = false; // avoid profiler output
477  throw e;
478  }
479 
480  if (vm.count("log")) {
481  this->log_filename_ = vm["log"].as<string>();
482  }
483 
484  if (vm.count("no_log")) {
485  this->log_filename_="//"; // override; do not open log files
486  }
487 
488  ostringstream tmp_stream(program_arguments_desc_);
489  tmp_stream << desc;
490  // TODO: catch specific exceptions and output usage messages
491 }
492 
493 /**
494  * Contains basic structure of application (initialization, run and finalization).
495  * Method is call after constructor and allows to call virtual methods.
496  */
497 
498 void Application::init(int argc, char ** argv) {
499  // parse our own command line arguments, leave others for PETSc
500 
501  this->parse_cmd_line(argc, argv);
502 
503  string build = string(__DATE__) + ", " + string(__TIME__)
504  + " flags: " + string(FLOW123D_COMPILER_FLAGS_);
505 
506  Input::Type::RevNumData rev_num_data = get_rev_num_data();
507  Profiler::instance()->set_program_info("Flow123d",
508  rev_num_data.version, rev_num_data.branch, rev_num_data.revision, build);
509 
512 
513  armadillo_setup(); // set catching armadillo exceptions and reporting stacktrace
514 
515  this->petsc_initialize(argc, argv);
516  petsc_initialized = true;
517 
518  this->permon_initialize(argc, argv);
519  permon_initialized = true;
520 
521  this->system_init(PETSC_COMM_WORLD, log_filename_); // Petsc, open log, read ini file
522 
523 
524 }
525 
526 
527 
529  START_TIMER("Application::run");
530  display_version();
531 
532  START_TIMER("Read Input");
533  // get main input record handle
534  Input::Record i_rec = read_input();
535  END_TIMER("Read Input");
536 
537  {
538  using namespace Input;
539  // check input file version against the version of executable
540  std::regex version_re("([^.]*)[.]([^.]*)[.]([^.]*)");
541  std::smatch match;
542  std::string version(FLOW123D_VERSION_NAME_);
543  vector<string> ver_fields(3);
544  if ( std::regex_match(version, match, version_re) ) {
545  ver_fields[0]=match[1];
546  ver_fields[1]=match[2];
547  ver_fields[2]=match[3];
548  } else {
549  ASSERT_PERMANENT(0)(version).error("Bad Flow123d version format\n");
550  }
551 
552  std::string input_version = i_rec.val<string>("flow123d_version");
553  vector<string> iver_fields(3);
554  if ( std::regex_match(input_version, match, version_re) ) {
555  iver_fields[0]=match[1];
556  iver_fields[1]=match[2];
557  iver_fields[2]=match[3];
558  } else {
559  THROW( ExcVersionFormat() << EI_InputVersionStr(input_version) );
560  }
561 
562  if ( iver_fields[0] != ver_fields[0] || iver_fields[1] > ver_fields[1] ) {
563  WarningOut().fmt("Input file with version: '{}' is no compatible with the program version: '{}' \n",
564  input_version, version);
565  }
566 
567  // should flow123d wait for pressing "Enter", when simulation is completed
568  sys_info.pause_after_run = i_rec.val<bool>("pause_after_run");
569  // read record with problem configuration
570  Input::AbstractRecord i_problem = i_rec.val<AbstractRecord>("problem");
571 
572  if (i_problem.type() == HC_ExplicitSequential::get_input_type() ) {
573 
574  problem_ = new HC_ExplicitSequential(i_problem);
575 
576  // run simulation
578  } else {
579  THROW( ExcUnknownProblem() );
580  }
581 
582  }
583 
584  this->after_run();
585 }
586 
587 
588 
589 
592  printf("\nPress <ENTER> for closing the window\n");
593  getchar();
594  }
595 }
596 
597 
598 void _transform_profiler_data (const string &json_filepath, const string &output_file_suffix, const string &formatter) {
599  namespace py = pybind11;
600 
601  if (json_filepath == "") return;
602 
603  // grab module and function by importing module profiler_formatter_module.py
604  auto python_module = PythonLoader::load_module_by_name ("profiler.profiler_formatter_module");
605  //
606  // def convert (json_location, output_file, formatter):
607  //
608  auto convert_method = python_module.attr("convert");
609  // execute method with arguments
610  convert_method(json_filepath, (json_filepath + output_file_suffix), formatter);
611 
612 }
613 
614 
615 
616 
617 
619  if (problem_) delete problem_;
620 
621  if (use_profiler) {
622  // TODO: make a static output method that does nothing if the instance does not exist yet.
623  string profiler_json;
624  if (petsc_initialized) {
625  // log profiler data to this stream
626  profiler_json = Profiler::instance()->output(PETSC_COMM_WORLD, profiler_path);
627  } else {
628  profiler_json = Profiler::instance()->output(profiler_path);
629  }
630 
631  // call python script which transforms json file at given location
632  // Profiler::instance()->transform_profiler_data (".csv", "CSVFormatter");
633  _transform_profiler_data (profiler_json, ".txt", "SimpleTableFormatter2");
634 
635  // finally uninitialize
637  }
638 
639  // TODO: have context manager classes for petsc and permon initialization
640  // create a local variable in Application::run or so
641  permon_finalize();
642  petcs_finalize();
643 }
644 
645 
646 
647 
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:598
void system_signal_handler(int signal)
Definition: application.cc:71
#define FLOW123D_COMPILER_FLAGS_
named version of the program
Definition: application.cc:246
Input::Type::RevNumData get_rev_num_data()
Definition: application.cc:252
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:306
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:498
int petcs_finalize()
Definition: application.cc:188
void display_version()
Definition: application.cc:287
~Application()
Destructor.
Definition: application.cc:618
void system_init(MPI_Comm comm, const string &log_filename)
Definition: application.cc:102
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:236
void permon_initialize(int argc, char **argv)
Definition: application.cc:208
static Input::Type::Record & get_input_type()
Root of the Input::Type tree. Description of whole input structure.
Definition: application.cc:265
string petsc_redirect_file_
Definition: application.hh:205
void petsc_initialize(int argc, char **argv)
Definition: application.cc:163
Input::Record root_record
root input record
Definition: application.hh:242
void after_run()
Definition: application.cc:590
void parse_cmd_line(const int argc, char **argv)
Definition: application.cc:324
bool memory_monitoring
If true, memory monitoring is switched on.
Definition: application.hh:233
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:214
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
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
static LoggerOptions & get_instance()
Getter of singleton instance object.
int setup_mpi(MPI_Comm comm)
Set rank of actual process by MPI communicator.
void set_log_file(std::string log_file_base)
Initialize instance object in format 'log_file_base.process.log'.
static void uninitialize()
void output(MPI_Comm, ostream &)
static void set_memory_monitoring(bool)
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
FILE * log
Definition: system.hh:76
int my_proc
Definition: system.hh:79
int n_proc
Definition: system.hh:78
MPI_Comm comm
Definition: system.hh:81
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