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