cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
maincl.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2022 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*main program that reads input and calls cloudy to compute a single model, or
4  * try to optimize an observed model. Routine returns 0 if model is ok,
5  * and 1 if problems occurred. */
6 #include "cddefines.h"
7 #include "cddrive.h"
8 #include "input.h"
9 #include "prt.h"
10 #include "save.h"
11 #include "called.h"
12 #include "monitor_results.h"
13 #include "grid.h"
14 
15 exit_type cdMain( int argc, const char* argv[] );
16 
17 inline void print_delimiter(long nOptimiz)
18 {
19  fprintf( ioQQQ, " ************************************************** GRID_DELIMIT" );
20  if( nOptimiz >= 0 )
21  fprintf( ioQQQ, " -- grid%9.9ld", nOptimiz );
22  fprintf( ioQQQ, "\n" );
23 }
24 
27 int main( int argc, char *argv[] )
28 {
29  exit_type exit_status = ES_SUCCESS;
30 
31  DEBUG_ENTRY( "main()" );
32 
33  bool lgMPI = cpu.i().lgMPI();
34 
35  cpu.i().set_used_nCPU( 1 );
36  if( lgMPI )
37  {
38  MPI_Init( &argc, &argv );
39 
40  int nCPU = 1, nRANK = 0;
41  MPI_Comm_size( MPI_COMM_WORLD, &nCPU );
42  cpu.i().set_nCPU( nCPU );
43  cpu.i().set_used_nCPU( nCPU );
44  MPI_Comm_rank( MPI_COMM_WORLD, &nRANK );
45  cpu.i().set_nRANK( nRANK );
46 
47  // MPI_Init() will have overwritten our signal handlers
48  // so we need to set them again....
50  }
51 
52  // save headers are needed for sequential runs
53  // saving headers during the initial parsing of grid runs is also OK
54  save.SetSaveHeaderNeeded( true );
55 
56  // this will generate input files for each grid point,
57  // or execute the Phymir run, whichever is appropriate
58  exit_status = cdMain( argc, (const char**)argv );
59 
60  // wait for writing of input files to finish
61  if( lgMPI )
62  MPI_Barrier( MPI_COMM_WORLD );
63 
64  // process the individual grid points
65  if( grid.lgGrid && exit_status == ES_SUCCESS )
66  {
67  // this was set to true after we wrote the last input script
68  grid.lgGridDone = false;
69  // signal that we are running individual grid models now...
70  grid.lgInsideGrid = true;
71 
72  // from now on each rank will run its own model
73  cpu.i().set_MPISingleRankMode( true );
74 
75  unsigned int nCPU;
76  if( lgMPI )
77  nCPU = cpu.i().nCPU();
78  else
79  nCPU = grid.lgParallel ? grid.useCPU : 1;
80  cpu.i().set_used_nCPU( nCPU );
81 
82  load_balance lb( grid.totNumModels, nCPU );
83 
84  // Each MPI rank will get jobs assigned by lb and execute them.
85  // If there are no jobs left, lb.next_job() will return -1.
86  exit_type retval = ES_SUCCESS;
87  while( ( optimize.nOptimiz = lb.next_job() ) >= 0 )
88  {
89  const char** mpi_argv = new const char*[argc+2];
90 
91  string jobName = GridPointPrefix( optimize.nOptimiz );
92  for( int i=0; i < argc; ++i )
93  mpi_argv[i] = argv[i];
94  mpi_argv[argc] = "-g";
95  mpi_argv[argc+1] = jobName.c_str();
96 
97  // only save header if we are calculating the first grid model
99 
100  retval = cdMain( argc+2, mpi_argv );
101 
102  exit_status = max( retval, exit_status );
103  delete[] mpi_argv;
104 
105  ++grid.seqNum;
106  }
107 
108  lb.finalize( exit_status );
109 
110  grid.lgGridDone = true;
111 
112  if( retval != ES_SUCCESS )
113  {
114  // Now parse the main input file once again to make sure that
115  // process_ouput() has the correct information available. This
116  // may be needed if the last grid model of this rank failed
117  // during parsing, which could lead to incorrect settings...
118  // Parsing is guaranteed to succeed since this was already
119  // done once before, and therefore we ignore the return value.
120  cpu.i().set_MPISingleRankMode( false );
121  grid.lgParseOnly = true;
122  (void)cdMain( argc, (const char**)argv );
123  }
124 
125  // concatenate the output
126  process_output();
127  }
128 
129  // remove empty output files from slave ranks
130  if( lgMPI && cpu.i().lgMaster() )
131  {
132  for( long n=1; n < cpu.i().nCPU(); ++n )
133  {
134  ostringstream oss;
135  oss << ".err" << setfill('0') << setw(2) << n;
136  string slave_output = save.chRedirectPrefix + oss.str();
137  FILE *io = open_data( slave_output.c_str(), "a" );
138  bool lgEmpty = ( ftell(io) == 0 );
139  fclose( io );
140  if( lgEmpty )
141  remove( slave_output.c_str() );
142  }
143  }
144 
145  if( lgMPI )
146  MPI_Finalize();
147 
148  return exit_status;
149 }
150 
152 exit_type cdMain( int argc, const char* argv[] )
153 {
154  /* these will be used to count number of various problems */
155  long int NumberWarnings,
156  NumberCautions,
157  NumberNotes,
158  NumberSurprises,
159  NumberTempFailures,
160  NumberPresFailures,
161  NumberIonFailures,
162  NumberNeFailures;
163 
164  bool lgAbort_exit,
165  lgEarly_exit=true,
166  lgFileIO;
167 
168  int i;
169  const char *s,
170  *prefix = "",
171  *gprefix = "", // grid prefix
172  *pprefix = "", // save prefix
173  *rprefix = ""; // redirect prefix
174  string infile("");
175  char *outfile = NULL;
176 
177  /* the length of the following vector will be the longest line image
178  * the code will be able to read here. Cloudy itself will ignore anything
179  * beyond INPUT_LINE_LENGTH, and checks that no information exists beyond it.
180  * The code will stop if the input line is longer than INPUT_LINE_LENGTH
181  * since extra characters would become a new command line due to buffer overrun */
182  char chLine[INPUT_LINE_LENGTH];
183 
184  /* indicates that a command line flag to redirect I/O has been used */
185  lgFileIO = false;
186 
187  exit_type exit_status = ES_SUCCESS;
188 
189  DEBUG_ENTRY( "cdMain()" );
190 
191  try {
192  /* Handle argument input */
193  for( i=1; i < argc; i++ )
194  {
195  s = argv[i];
196  if( *s != '-' || s[1] == '\0' )
197  {
198  if( infile != "" )
199  {
200  fprintf( ioQQQ, "%s: only one input file argument allowed\n", argv[0] );
202  }
203  infile = s;
204  if( infile.find( cpu.i().chDirSeparator() ) != string::npos )
205  {
206  fprintf( ioQQQ, "%s %s: read/write from subdirectories is not supported\n",
207  argv[0], infile.c_str() );
209  }
210  if( infile != "-" )
211  {
212  FILE *fp = open_data( infile.c_str(), "r", AS_LOCAL_ONLY_TRY );
213  if( fp == NULL )
214  {
215  fprintf( ioQQQ, " input file \"%s\" not found\n", infile.c_str() );
217  }
218  fclose(fp);
219  size_t suffindex = infile.find_last_of(".");
220  if (suffindex != string::npos)
221  infile = infile.substr(0,suffindex);
222  pprefix = rprefix = infile.c_str();
223  lgFileIO = true;
224  }
225  }
226  else
227  {
228  while( s != NULL && *(++s) )
229  {
230  exit_type exit = ES_SUCCESS;
231  switch( *s )
232  {
233  case 'a':
234  cpu.i().setAssertAbort( true );
235  break;
236  case 'g':
237  case 'p':
238  case 'r':
239  if( s[1] != '\0' )
240  {
241  prefix = s+1;
242  }
243  else
244  {
245  if( ++i == argc || argv[i][0] == '-' )
246  {
247  fprintf( ioQQQ, "%s: no argument given for -%c flag\n",
248  argv[0], *s );
250  }
251  prefix = argv[i];
252  if( strchr(prefix, cpu.i().chDirSeparator()) != NULL )
253  {
254  fprintf( ioQQQ, "%s -%c %s: writing in subdirectories is not supported\n",
255  argv[0], *s, prefix );
257  }
258  }
259  if( *s == 'g' )
260  gprefix = prefix;
261  else if( *s == 'p' )
262  {
263  pprefix = prefix;
264  rprefix = prefix;
265  }
266  else if( *s == 'r' )
267  {
268  // make sure we erase the effects of a possible earlier -p flag
269  pprefix = "";
270  rprefix = prefix;
271  }
272  else
273  TotalInsanity();
274  s = NULL;
275  lgFileIO = true;
276  break;
277  default:
278  fprintf( ioQQQ, "%s: argument %d, `%s': flag -%c not understood\n",
279  argv[0], i, argv[i], *s );
280  exit = ES_FAILURE;
281  FALLTHROUGH;
282  case 'h':
283  fprintf( ioQQQ, "\nSupported flags are:\n\n" );
284  fprintf( ioQQQ, "-p example\n" );
285  fprintf( ioQQQ, " Cloudy reads the input from the file example.in\n" );
286  fprintf( ioQQQ, " and writes the output to the file example.out.\n" );
287  fprintf( ioQQQ, " Additionally, all file names in SAVE commands are\n" );
288  fprintf( ioQQQ, " prepended with the string \"example\", e.g. the\n" );
289  fprintf( ioQQQ, " output of SAVE DR \".dr\" will be in example.dr.\n" );
290  fprintf( ioQQQ, "-r example\n" );
291  fprintf( ioQQQ, " This does the same as the -p switch, except that\n" );
292  fprintf( ioQQQ, " the names used in SAVE commands are not altered.\n" );
293  fprintf( ioQQQ, "-g example\n" );
294  fprintf( ioQQQ, " This switch is used internally in MPI grid runs.\n" );
295  fprintf( ioQQQ, " Normal users should not use this switch.\n" );
296  fprintf( ioQQQ, "-a\n" );
297  fprintf( ioQQQ, " This switch is used in debugging. It causes the\n" );
298  fprintf( ioQQQ, " code to crash rather than exit gracefully after\n" );
299  fprintf( ioQQQ, " a failed assert. This flag is deprecated.\n" );
300  fprintf( ioQQQ, "-h\n" );
301  fprintf( ioQQQ, " Print this message.\n" );
302  cdEXIT(exit);
303  }
304  }
305  }
306  }
307 
308  /* initialize the code for this run */
309  cdInit();
310 
311  save.chGridPrefix = gprefix;
312  save.chFilenamePrefix = pprefix;
313  save.chRedirectPrefix = rprefix;
314 
315  /* following should be set true to print to file instead of std output */
316  if( lgFileIO )
317  {
318  string Base = save.chGridPrefix + save.chRedirectPrefix;
319  cdInput( Base + ".in" );
320  if( grid.lgParseOnly )
321  {
322  // When here, we parse the input again to make sure that
323  // certain variables are correctly set which are needed
324  // when postprocessing the output. We are not interested
325  // in the output, so we redirect that to a temp file that
326  // will be discarded just before we return.
327  outfile = new char[Base.length()+8];
328  string OutName( Base + ".XXXXXX" );
329  strcpy( outfile, OutName.c_str() );
330  int fd = mkstemp( outfile );
331  cdOutput( outfile, fdopen(fd, "w") );
332  }
333  else if( cpu.i().lgMPI_talk() )
334  {
335  cdOutput( Base + ".out" );
336  }
337  else
338  {
339  ostringstream oss;
340  oss << ".err" << setfill('0') << setw(2) << cpu.i().nRANK();
341  cdOutput( Base + oss.str() );
342  }
343  }
344 
345  if( optimize.nOptimiz == 0 && called.lgTalk && cpu.i().lgMPISingleRankMode() )
346  print_delimiter(-1);
347 
348  input.curInclLevel = 0;
349  /* keep reading input lines until end of file */
350  while( read_whole_line(chLine, (int)sizeof(chLine), ioStdin) != NULL )
351  {
352  bool lgReadingOutput = ( strncmp(chLine," * ",25) == 0 );
353  char* chLocal = lgReadingOutput ? chLine+25 : chLine;
354 
355  if( lgInputEOF(chLocal) )
356  break;
357 
358  /* stuff the command line into the internal stack */
359  (void)cdRead(chLocal);
360  }
361  ASSERT( input.curInclLevel == 0 );
362 
363  if( lgAbort )
364  {
365  /* input parser hit something REALLY bad */
367  }
368 
369  // optimize.lgVaryOn catches both optimizer and grid runs
370  if( ( cpu.i().lgMPI() || optimize.lgVaryOn ) && save.chRedirectPrefix.empty() )
371  {
372  if( cpu.i().lgMaster() )
373  {
374  if( cpu.i().lgMPI() )
375  fprintf( ioQQQ, " Please use the style \"mpirun -n np /path/to/cloudy.exe -r input\" when doing grid\n"
376  " or optimizer runs. See http://trac.nublado.org/wiki/RunCode for more information.\n" );
377  else
378  fprintf( ioQQQ, " Please use the style \"/path/to/cloudy.exe -r input\" when doing grid\n"
379  " or optimizer runs. See http://trac.nublado.org/wiki/RunCode for more information.\n" );
380  }
381  // stop the grid from being executed any further
382  grid.lgGrid = false;
384  }
385 
386  /* actually call the code. This routine figures out whether the code will do
387  * a single model or be used to optimize on a spectrum, by looking for the
388  * keyword VARY on command lines. It will call routine cloudy if no vary commands
389  * occur, and lgOptimize_do if VARY does occur.
390  * cdDrive returns 0 if calculation is ok, 1 if problems happened */
391  if( cdDrive() )
392  exit_status = ES_FAILURE;
393 
394  /* the last line of output will contain some interesting information about the model*/
395  cdNwcns(
396  /* abort status, this better be false, 0 */
397  &lgAbort_exit,
398  /* the number of warnings, cautions, notes, and surprises */
399  &NumberWarnings,
400  &NumberCautions,
401  &NumberNotes,
402  &NumberSurprises,
403  /* the number of temperature convergence failures */
404  &NumberTempFailures,
405  /* the number of pressure convergence failures */
406  &NumberPresFailures,
407  /* the number of ionization convergence failures */
408  &NumberIonFailures,
409  /* the number of electron density convergence failures */
410  &NumberNeFailures );
411 
412  ostringstream finalMsg;
413 
414  finalMsg << " Cloudy ends: " << nzone << " zone";
415  if( nzone > 1 )
416  finalMsg << "s";
417 
418  finalMsg << ", " << iteration << " iteration";
419  if( iteration > 1 )
420  finalMsg << "s";
421 
422  if( lgAbort_exit )
423  finalMsg << ", ABORT DISASTER PROBLEM";
424 
425  if( NumberWarnings > 0 )
426  {
427  finalMsg << ", " << NumberWarnings << " warning";
428  if( NumberWarnings > 1 )
429  finalMsg << "s";
430  /* this indicates error */
431  exit_status = ES_FAILURE;
432  }
433 
434  if( NumberCautions > 0 )
435  {
436  finalMsg << ", " << NumberCautions << " caution";
437  if( NumberCautions > 1 )
438  finalMsg << "s";
439  }
440 
441  /* this flag was set in lgCheckMonitors*/
442  if( !lgMonitorsOK )
443  {
444  finalMsg << ", ";
445  /* some botches were three sigma */
446  if( lgBigBotch )
447  finalMsg << "BIG ";
448  finalMsg << "BOTCHED MONITORS!!!";
449  /* this indicates error */
450  exit_status = ES_FAILURE;
451  }
452 
453  if( NumberTempFailures+NumberPresFailures+NumberIonFailures+NumberNeFailures > 0 )
454  {
455  finalMsg << ". Failures: " << NumberTempFailures << " thermal, ";
456  finalMsg << NumberPresFailures << " pressure, ";
457  finalMsg << NumberIonFailures << " ionization, ";
458  finalMsg << NumberNeFailures << " electron density";
459  }
460 
461  if( prt.lgPrintTime )
462  {
463  if( !cpu.i().lgMPI() && cpu.i().used_nCPU() == 1 )
464  {
465  finalMsg << ". (single thread)";
466  }
467  else if( !cpu.i().lgMPI() )
468  {
469  finalMsg << ". (" << cpu.i().used_nCPU() << " forked threads)";
470  }
471  else if( cpu.i().lgMPI() )
472  {
473  finalMsg << ". (rank " << cpu.i().nRANK() << " of " << cpu.i().used_nCPU() << " MPI ranks)";
474  }
475  if (0)
476  finalMsg << " Max memory used " << cdMemory() << "kB.";
477  /* NB DO NOT CHANGE ANY ASPECT OF THE FOLLOWING STRINGS - THEY ARE USED TO RECORD
478  * EXEC TIME BY A PERL SCRIPT */
479  /* print execution time [s] by default,
480  * need spaces around number so that logging perl script picks up correct number
481  * ir_extime.pl script will delete through "ExecTime(s)" and remainder of line must be number */
482  finalMsg << " ExecTime(s) " << fixed << setprecision(2) << cdExecTime();
483  }
484  else
485  {
486  finalMsg << ".";
487  }
488 
489  if( called.lgTalk )
490  fprintf( ioQQQ, "%s\n", finalMsg.str().c_str() );
491 
492  lgEarly_exit = false;
493 
494  /* cdDrive returned 1 if something bad happened, and 0 if everything is ok. We will
495  * return 0 if everything is ok, and a non-zero error code if something bad happened.*/
496  cdEXIT(exit_status);
497  }
498  catch( bad_alloc& )
499  {
500  fprintf( ioQQQ, " DISASTER - A memory allocation has failed. Most likely your computer "
501  "ran out of memory.\n Try monitoring the memory use of your run. Bailing out...\n" );
502  exit_status = ES_BAD_ALLOC;
503  }
504  catch( out_of_range& e )
505  {
506  fprintf( ioQQQ, " DISASTER - An out_of_range exception was caught, what() = %s. Bailing out...\n",
507  e.what() );
508  exit_status = ES_OUT_OF_RANGE;
509  }
510  catch( domain_error& e )
511  {
512  fprintf( ioQQQ, " DISASTER - A vectorized math routine threw a domain_error. Bailing out...\n" );
513  fprintf( ioQQQ, " What() = %s", e.what() );
514  exit_status = ES_DOMAIN_ERROR;
515  }
516  catch( bad_assert& e )
517  {
518  MyAssert( e.file(), e.line() , e.comment() );
519  exit_status = ES_BAD_ASSERT;
520  }
521 #ifdef CATCH_SIGNAL
522  catch( bad_signal& e )
523  {
524  if( ioQQQ != NULL )
525  {
526  if( e.sig() == SIGINT || e.sig() == SIGQUIT )
527  {
528  fprintf( ioQQQ, " User interrupt request. Bailing out...\n" );
529  exit_status = ES_USER_INTERRUPT;
530  }
531  else if( e.sig() == SIGTERM )
532  {
533  fprintf( ioQQQ, " Termination request. Bailing out...\n" );
534  exit_status = ES_TERMINATION_REQUEST;
535  }
536  else if( e.sig() == SIGILL )
537  {
538  fprintf( ioQQQ, " DISASTER - An illegal instruction was found. Bailing out...\n" );
539  exit_status = ES_ILLEGAL_INSTRUCTION;
540  }
541  else if( e.sig() == SIGFPE )
542  {
543  fprintf( ioQQQ, " DISASTER - A floating point exception occurred. Bailing out...\n" );
544  exit_status = ES_FP_EXCEPTION;
545  }
546  else if( e.sig() == SIGSEGV )
547  {
548  fprintf( ioQQQ, " DISASTER - A segmentation violation occurred. Bailing out...\n" );
549  exit_status = ES_SEGFAULT;
550  }
551 # ifdef SIGBUS
552  else if( e.sig() == SIGBUS )
553  {
554  fprintf( ioQQQ, " DISASTER - A bus error occurred. Bailing out...\n" );
555  exit_status = ES_BUS_ERROR;
556  }
557 # endif
558  else
559  {
560  fprintf( ioQQQ, " DISASTER - A signal %d was caught. Bailing out...\n", e.sig() );
561  exit_status = ES_UNKNOWN_SIGNAL;
562  }
563 
564  }
565  }
566 #endif
567  catch( cloudy_exit& e )
568  {
569  if( called.lgTalk )
570  {
571  ostringstream oss;
572  oss << " [Stop in " << e.routine();
573  oss << " at " << e.file() << ":" << e.line();
574  if( e.exit_status() == 0 )
575  oss << ", Cloudy exited OK]";
576  else
577  oss << ", something went wrong]";
578  fprintf( ioQQQ, "%s\n", oss.str().c_str() );
579  }
580 
581  if ( called.lgTalk && prt.lgPrintHTML )
582  {
583  fprintf( ioQQQ,"</pre>\n");
584  fprintf( ioQQQ,"</body>\n");
585  fprintf( ioQQQ,"</html>\n");
586  }
587 
588  exit_status = e.exit_status();
589  if( exit_status == ES_FAILURE && !lgEarly_exit )
590  {
591  // try to make the error code more descriptive
592  // when there is no early exit in the code, then these 3
593  // should be the only reasons for a non-zero exit code
594  if( NumberWarnings > 0 )
595  exit_status = ES_WARNINGS;
596  if( !lgMonitorsOK )
597  exit_status = ES_BOTCHES;
598  if( lgAbort_exit )
599  exit_status = ES_CLOUDY_ABORT;
600  }
601  }
602  catch( std::exception& e )
603  {
604  fprintf( ioQQQ, " DISASTER - An unknown exception was caught, what() = %s. Bailing out...\n",
605  e.what() );
606  exit_status = ES_UNKNOWN_EXCEPTION;
607  }
608  // generic catch-all in case we forget any specific exception above... so this MUST be the last one.
609  catch( ... )
610  {
611  fprintf( ioQQQ, " DISASTER - An unknown exception was caught. Bailing out...\n" );
612  exit_status = ES_UNKNOWN_EXCEPTION;
613  }
614 
615  if( called.lgTalk && cpu.i().lgMPISingleRankMode() )
617 
618  cdPrepareExit(exit_status);
619 
620  if( outfile != NULL )
621  {
622  remove( outfile );
623  delete[] outfile;
624  }
625 
626  return exit_status;
627 }
long nRANK() const
Definition: cpu.h:395
#define MPI_Comm_size(Y, Z)
Definition: mpi_utilities.h:87
const char * file() const
Definition: cddefines.h:588
void cdInit()
Definition: cdinit.cpp:46
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
Definition: cpu.cpp:765
void set_used_nCPU(long n)
Definition: cpu.h:389
void finalize(exit_type exit_status)
exit_type exit_status() const
Definition: cddefines.h:475
bool lgParseOnly
Definition: grid.h:44
NORETURN void TotalInsanity(void)
Definition: service.cpp:971
t_input input
Definition: input.cpp:12
string chGridPrefix
Definition: save.h:427
bool lgGrid
Definition: grid.h:41
string chFilenamePrefix
Definition: save.h:431
bool lgGridDone
Definition: grid.h:42
const char * file() const
Definition: cddefines.h:467
t_cpu_i & i()
Definition: cpu.h:419
const char * routine() const
Definition: cddefines.h:463
int cdDrive()
Definition: cddrive.cpp:81
#define MPI_Finalize()
Definition: mpi_utilities.h:86
int curInclLevel
Definition: input.h:92
int sig() const
Definition: cddefines.h:566
long int nOptimiz
Definition: optimize.h:250
#define MPI_Barrier(Z)
Definition: mpi_utilities.h:84
void setAssertAbort(bool val)
Definition: cpu.h:367
long used_nCPU() const
Definition: cpu.h:390
bool lgInputEOF(const char *chLine)
Definition: input.cpp:84
long line() const
Definition: cddefines.h:592
bool lgVaryOn
Definition: optimize.h:173
FILE * ioQQQ
Definition: cddefines.cpp:7
void set_nRANK(long n)
Definition: cpu.h:394
long int nzone
Definition: cddefines.cpp:14
bool lgTalk
Definition: called.h:12
int cdRead(const char *chInputLine)
Definition: cddrive.cpp:1466
exit_type
Definition: cddefines.h:142
void cdInput(const string &filename, const char *mode)
Definition: cddrive.cpp:1232
exit_type cdMain(int argc, const char *argv[])
Definition: maincl.cpp:152
long int iteration
Definition: cddefines.cpp:16
long totNumModels
Definition: grid.h:61
bool lgMonitorsOK
const int INPUT_LINE_LENGTH
Definition: cddefines.h:301
bool lgMaster() const
Definition: cpu.h:396
long max(int a, long b)
Definition: cddefines.h:817
#define cdEXIT(FAIL)
Definition: cddefines.h:482
bool lgMPI_talk() const
Definition: cpu.h:397
bool lgPrintTime
Definition: prt.h:161
int main(int argc, char *argv[])
Definition: maincl.cpp:27
t_optimize optimize
Definition: optimize.cpp:6
t_grid grid
Definition: grid.cpp:5
double cdExecTime()
Definition: cddrive.cpp:478
t_prt prt
Definition: prt.cpp:14
bool lgInsideGrid
Definition: grid.h:43
void MyAssert(const char *file, int line, const char *comment)
Definition: service.cpp:177
const char * comment() const
Definition: cddefines.h:596
#define ASSERT(exp)
Definition: cddefines.h:613
bool lgPrintHTML
Definition: prt.h:277
void print_delimiter(long nOptimiz)
Definition: maincl.cpp:17
bool lgBigBotch
long cdMemory()
Definition: cddrive.cpp:503
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
void set_signal_handlers()
Definition: cpu.cpp:519
bool lgMPI() const
Definition: cpu.h:391
long line() const
Definition: cddefines.h:471
void set_MPISingleRankMode(bool mode)
Definition: cpu.h:392
unsigned int useCPU
Definition: grid.h:50
void cdOutput(const string &filename, const char *mode)
Definition: cddrive.cpp:1209
void set_nCPU(long n)
Definition: cpu.h:387
void cdNwcns(bool *lgAbort_ret, long int *NumberWarnings, long int *NumberCautions, long int *NumberNotes, long int *NumberSurprises, long int *NumberTempFailures, long int *NumberPresFailures, long int *NumberIonFailures, long int *NumberNeFailures)
Definition: cddrive.cpp:1173
#define MPI_Comm_rank(Y, Z)
Definition: mpi_utilities.h:88
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
#define FALLTHROUGH
Definition: cpu.h:458
long seqNum
Definition: grid.h:69
long nCPU() const
Definition: cpu.h:388
char * read_whole_line(char *chLine, int nChar, FILE *ioIN)
Definition: service.cpp:70
string GridPointPrefix(int n)
void process_output()
static t_cpu cpu
Definition: cpu.h:427
t_save save
Definition: save.cpp:5
void SetSaveHeaderNeeded(bool lgVal)
Definition: save.h:350
string chRedirectPrefix
Definition: save.h:435
#define MPI_Init(Y, Z)
Definition: mpi_utilities.h:89
void cdPrepareExit(exit_type)
Definition: cdinit.cpp:134
char chDirSeparator() const
Definition: cpu.h:400
bool lgMPISingleRankMode() const
Definition: cpu.h:393
t_called called
Definition: called.cpp:4
bool lgParallel
Definition: grid.h:47
bool lgAbort
Definition: cddefines.cpp:10
FILE * ioStdin
Definition: cddefines.cpp:8