Actual source code: init.c

  1: /*$Id: init.c,v 1.77 2001/08/10 03:28:54 bsmith Exp $*/
  2: /*

  4:    This file defines part of the initialization of PETSc

  6:   This file uses regular malloc and free because it cannot know 
  7:   what malloc is being used until it has already processed the input.
  8: */

 10:  #include petsc.h
 11:  #include petscsys.h
 12: #if defined(PETSC_HAVE_STDLIB_H)
 13: #include <stdlib.h>
 14: #endif
 15: #if defined(PETSC_HAVE_MALLOC_H) && !defined(__cplusplus)
 16: #include <malloc.h>
 17: #endif
 18: #include "petscfix.h"

 20: /* ------------------------Nasty global variables -------------------------------*/
 21: /*
 22:      Indicates if PETSc started up MPI, or it was 
 23:    already started before PETSc was initialized.
 24: */
 25: PetscTruth PetscBeganMPI         = PETSC_FALSE;
 26: PetscTruth PetscInitializeCalled = PETSC_FALSE;
 27: int        PetscGlobalRank = -1,PetscGlobalSize = -1;
 28: MPI_Comm   PETSC_COMM_WORLD = 0;
 29: MPI_Comm   PETSC_COMM_SELF  = 0;

 31: #if defined(PETSC_USE_COMPLEX)
 32: #if defined(PETSC_COMPLEX_INSTANTIATE)
 33: template <> class std::complex<double>; /* instantiate complex template class */
 34: #endif
 35: MPI_Datatype  MPIU_COMPLEX;
 36: PetscScalar   PETSC_i;
 37: #else
 38: PetscScalar   PETSC_i = 0.0;
 39: #endif
 40: MPI_Datatype  MPIU_2SCALAR;

 42: /*
 43:      These are needed by petscbt.h
 44: */
 45: char _BT_mask,_BT_c;
 46: int  _BT_idx;

 48: /*
 49:      Determines if all PETSc objects are published to the AMS
 50: */
 51: #if defined(PETSC_HAVE_AMS)
 52: PetscTruth PetscAMSPublishAll = PETSC_FALSE;
 53: #endif

 55: /*
 56:        Function that is called to display all error messages
 57: */
 58: EXTERN int  PetscErrorPrintfDefault(const char [],...);
 59: EXTERN int  PetscHelpPrintfDefault(MPI_Comm,const char [],...);
 60: int (*PetscErrorPrintf)(const char [],...)          = PetscErrorPrintfDefault;
 61: int (*PetscHelpPrintf)(MPI_Comm,const char [],...)  = PetscHelpPrintfDefault;

 63: /* ------------------------------------------------------------------------------*/
 64: /* 
 65:    Optional file where all PETSc output from various prints is saved
 66: */
 67: FILE *petsc_history = PETSC_NULL;

 69: #undef __FUNCT__  
 71: int PetscLogOpenHistoryFile(const char filename[],FILE **fd)
 72: {
 73:   int  ierr,rank,size;
 74:   char pfile[PETSC_MAX_PATH_LEN],pname[PETSC_MAX_PATH_LEN],fname[PETSC_MAX_PATH_LEN],date[64];
 75:   char version[256];

 78:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
 79:   if (!rank) {
 80:     char arch[10];
 81:     PetscGetArchType(arch,10);
 82:     PetscGetDate(date,64);
 83:     PetscGetVersion(&version);
 84:     MPI_Comm_size(PETSC_COMM_WORLD,&size);
 85:     if (filename) {
 86:       PetscFixFilename(filename,fname);
 87:     } else {
 88:       PetscGetHomeDirectory(pfile,240);
 89:       PetscStrcat(pfile,"/.petschistory");
 90:       PetscFixFilename(pfile,fname);
 91:     }

 93:     *fd = fopen(fname,"a"); if (!fd) SETERRQ1(PETSC_ERR_FILE_OPEN,"Cannot open file: %s",fname);
 94:     fprintf(*fd,"---------------------------------------------------------n");
 95:     fprintf(*fd,"%s %sn",version,date);
 96:     PetscGetProgramName(pname,PETSC_MAX_PATH_LEN);
 97:     fprintf(*fd,"%s on a %s, %d proc. with options:n",pname,arch,size);
 98:     PetscOptionsPrint(*fd);
 99:     fprintf(*fd,"---------------------------------------------------------n");
100:     fflush(*fd);
101:   }
102:   return(0);
103: }

105: #undef __FUNCT__  
107: int PetscLogCloseHistoryFile(FILE **fd)
108: {
109:   int  rank,ierr;
110:   char date[64];

113:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
114:   if (rank) return(0);
115:   PetscGetDate(date,64);
116:   fprintf(*fd,"---------------------------------------------------------n");
117:   fprintf(*fd,"Finished at %sn",date);
118:   fprintf(*fd,"---------------------------------------------------------n");
119:   fflush(*fd);
120:   fclose(*fd);
121:   return(0);
122: }

124: /* ------------------------------------------------------------------------------*/

126: PetscTruth PetscCompare          = PETSC_FALSE;
127: PetscReal  PetscCompareTolerance = 1.e-10;

129: #undef __FUNCT__  
131: /*@C
132:    PetscCompareInt - Compares integers while running with PETScs incremental
133:    debugger.

135:    Collective on PETSC_COMM_WORLD

137:    Input Parameter:
138: .  d - integer to compare

140:    Options Database Key:
141: .  -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()

143:    Level: advanced

145: .seealso: PetscCompareDouble(), PetscCompareScalar()
146: @*/
147: int PetscCompareInt(int d)
148: {
149:   int work = d,ierr;

152:   MPI_Bcast(&work,1,MPI_INT,0,MPI_COMM_WORLD);
153:   if (d != work) {
154:     SETERRQ(PETSC_ERR_PLIB,"Inconsistent integer");
155:   }
156:   return(0);
157: }

159: #undef __FUNCT__  
161: /*@C
162:    PetscCompareDouble - Compares doubles while running with PETScs incremental
163:    debugger.

165:    Collective on PETSC_COMM_WORLD

167:    Input Parameter:
168: .  d - double precision number to compare

170:    Options Database Key:
171: .  -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()

173:    Level: advanced

175: .seealso: PetscCompareInt(), PetscComparseScalar()
176: @*/
177: int PetscCompareDouble(double d)
178: {
179:   double work = d;
180:   int    ierr;

183:   MPI_Bcast(&work,1,MPIU_REAL,0,MPI_COMM_WORLD);
184:   if (!d && !work) return(0);
185:   if (PetscAbsReal(work - d)/PetscMax(PetscAbsReal(d),PetscAbsReal(work)) > PetscCompareTolerance) {
186:     SETERRQ(PETSC_ERR_PLIB,"Inconsistent double");
187:   }
188:   return(0);
189: }

191: #undef __FUNCT__  
193: /*@C
194:    PetscCompareScalar - Compares scalars while running with PETScs incremental
195:    debugger.

197:    Collective on PETSC_COMM_WORLD

199:    Input Parameter:
200: .  d - scalar to compare

202:    Options Database Key:
203: .  -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()

205:    Level: advanced

207: .seealso: PetscCompareInt(), PetscComparseDouble()
208: @*/
209: int PetscCompareScalar(PetscScalar d)
210: {
211:   PetscScalar work = d;
212:   int         ierr;

215:   MPI_Bcast(&work,2,MPIU_REAL,0,MPI_COMM_WORLD);
216:   if (!PetscAbsScalar(d) && !PetscAbsScalar(work)) return(0);
217:   if (PetscAbsScalar(work - d)/PetscMax(PetscAbsScalar(d),PetscAbsScalar(work)) >= PetscCompareTolerance) {
218:     SETERRQ(PETSC_ERR_PLIB,"Inconsistent scalar");
219:   }
220:   return(0);
221: }

223: #undef __FUNCT__  
225: /*
226:     PetscCompareInitialize - If there is a command line option -compare then
227:     this routine calls MPI_Init() and sets up two PETSC_COMM_WORLD, one for 
228:     each program being compared.

230:     Note: 
231:     Only works with C programs.
232: */
233: int PetscCompareInitialize(double tol)
234: {
235:   int        ierr,i,len,rank,*gflag,size,mysize;
236:   char       pname[PETSC_MAX_PATH_LEN],basename[PETSC_MAX_PATH_LEN];
237:   MPI_Group  group_all,group_sub;
238:   PetscTruth work;

241:   PetscGetProgramName(pname,PETSC_MAX_PATH_LEN);
242:   PetscCompareTolerance = tol;

244:   MPI_Comm_rank(MPI_COMM_WORLD,&rank);
245:   MPI_Comm_size(MPI_COMM_WORLD,&size);
246:   if (!rank) {
247:     PetscStrcpy(basename,pname);
248:     PetscStrlen(basename,&len);
249:   }

251:   /* broadcase name from first processor to all processors */
252:   MPI_Bcast(&len,1,MPI_INT,0,MPI_COMM_WORLD);
253:   MPI_Bcast(basename,len+1,MPI_CHAR,0,MPI_COMM_WORLD);

255:   /* determine what processors belong to my group */
256:   PetscStrcmp(pname,basename,&work);

258:   gflag = (int*)malloc(size*sizeof(int));
259:   MPI_Allgather(&work,1,MPI_INT,gflag,1,MPI_INT,MPI_COMM_WORLD);
260:   mysize = 0;
261:   for (i=0; i<size; i++) {
262:     if (work == gflag[i]) gflag[mysize++] = i;
263:   }
264:   /* printf("[%d] my name %s basename %s mysize %dn",rank,programname,basename,mysize); */

266:   if (!mysize || mysize == size) {
267:     SETERRQ(PETSC_ERR_ARG_IDN,"Need two different programs to compare");
268:   }

270:   /* create a new communicator for each program */
271:   MPI_Comm_group(MPI_COMM_WORLD,&group_all);
272:   MPI_Group_incl(group_all,mysize,gflag,&group_sub);
273:   MPI_Comm_create(MPI_COMM_WORLD,group_sub,&PETSC_COMM_WORLD);
274:   MPI_Group_free(&group_all);
275:   MPI_Group_free(&group_sub);
276:   free(gflag);

278:   PetscCompare = PETSC_TRUE;
279:   PetscLogInfo(0,"PetscCompareInitialize:Configured to compare two programsn");
280:   return(0);
281: }
282: /* ------------------------------------------------------------------------------------*/

284: 
285: /* 
286:    This is ugly and probably belongs somewhere else, but I want to 
287:   be able to put a true MPI abort error handler with command line args.

289:     This is so MPI errors in the debugger will leave all the stack 
290:   frames. The default abort cleans up and exits.
291: */

293: #undef __FUNCT__  
295: void Petsc_MPI_AbortOnError(MPI_Comm *comm,int *flag)
296: {
298:   (*PetscErrorPrintf)("MPI error %dn",*flag);
299:   abort();
300: }

302: #undef __FUNCT__  
304: void Petsc_MPI_DebuggerOnError(MPI_Comm *comm,int *flag)
305: {

309:   (*PetscErrorPrintf)("MPI error %dn",*flag);
310:   PetscAttachDebugger();
311:   if (ierr) { /* hopeless so get out */
312:     MPI_Finalize();
313:     exit(*flag);
314:   }
315: }

317: #undef __FUNCT__  
319: /*@C 
320:    PetscEnd - Calls PetscFinalize() and then ends the program. This is useful if one 
321:      wishes a clean exit somewhere deep in the program.

323:    Collective on PETSC_COMM_WORLD

325:    Options Database Keys are the same as for PetscFinalize()

327:    Level: advanced

329:    Note:
330:    See PetscInitialize() for more general runtime options.

332: .seealso: PetscInitialize(), PetscOptionsPrint(), PetscTrDump(), PetscMPIDump(), PetscFinalize()
333: @*/
334: int PetscEnd(void)
335: {
337:   PetscFinalize();
338:   exit(0);
339:   return 0;
340: }

342: PetscTruth        PetscOptionsPublish = PETSC_FALSE;
343: EXTERN int        PetscLogInfoAllow(PetscTruth,char *);
344: EXTERN int        PetscSetUseTrMalloc_Private(void);
345: extern PetscTruth petscsetmallocvisited;
346: static char       emacsmachinename[128];

348: int (*PetscExternalVersionFunction)(MPI_Comm) = 0;
349: int (*PetscExternalHelpFunction)(MPI_Comm)    = 0;

351: #undef __FUNCT__  
353: /*@C 
354:    PetscSetHelpVersionFunctions - Sets functions that print help and version information
355:    before the PETSc help and version information is printed. Must call BEFORE PetscInitialize().
356:    This routine enables a "higher-level" package that uses PETSc to print its messages first.

358:    Input Parameter:
359: +  help - the help function (may be PETSC_NULL)
360: -  version - the version function (may be PETSc null)

362:    Level: developer

364:    Concepts: package help message

366: @*/
367: int PetscSetHelpVersionFunctions(int (*help)(MPI_Comm),int (*version)(MPI_Comm))
368: {
370:   PetscExternalHelpFunction    = help;
371:   PetscExternalVersionFunction = version;
372:   return(0);
373: }

375: #undef __FUNCT__  
377: int PetscOptionsCheckInitial_Private(void)
378: {
379:   char       string[64],mname[PETSC_MAX_PATH_LEN],*f;
380:   MPI_Comm   comm = PETSC_COMM_WORLD;
381:   PetscTruth flg1,flg2,flg3,flag;
382:   int        ierr,*nodes,i,rank;
383:   char       version[256];

386:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);

388: #if defined(PETSC_HAVE_AMS)
389:   PetscOptionsHasName(PETSC_NULL,"-ams_publish_options",&flg3);
390:   if (flg3) PetscOptionsPublish = PETSC_TRUE;
391: #endif

393:   /*
394:       Setup the memory management; support for tracing malloc() usage 
395:   */
396:   PetscOptionsHasName(PETSC_NULL,"-trmalloc_log",&flg3);
397: #if defined(PETSC_USE_BOPT_g)
398:   PetscOptionsGetLogical(PETSC_NULL,"-trmalloc",&flg1,&flg2);
399:   if ((!flg2 || flg1) && !petscsetmallocvisited) {
400:     PetscSetUseTrMalloc_Private();
401:   }
402: #else
403:   PetscOptionsHasName(PETSC_NULL,"-trdump",&flg1);
404:   PetscOptionsHasName(PETSC_NULL,"-trmalloc",&flg2);
405:   if (flg1 || flg2 || flg3) {PetscSetUseTrMalloc_Private();}
406: #endif
407:   if (flg3) {
408:     PetscTrLog();
409:   }
410:   PetscOptionsHasName(PETSC_NULL,"-trdebug",&flg1);
411:   if (flg1) {
412:     PetscSetUseTrMalloc_Private();
413:     PetscTrDebugLevel(1);
414:   }

416:   /*
417:       Set the display variable for graphics
418:   */
419:   PetscSetDisplay();

421:   /*
422:       Print the PETSc version information
423:   */
424:   PetscOptionsHasName(PETSC_NULL,"-v",&flg1);
425:   PetscOptionsHasName(PETSC_NULL,"-version",&flg2);
426:   PetscOptionsHasName(PETSC_NULL,"-help",&flg3);
427:   if (flg1 || flg2 || flg3){

429:     /*
430:        Print "higher-level" package version message 
431:     */
432:     if (PetscExternalVersionFunction) {
433:       (*PetscExternalVersionFunction)(comm);
434:     }

436:     PetscGetVersion(&version);
437:     (*PetscHelpPrintf)(comm,"--------------------------------------------
438: ------------------------------n");
439:     (*PetscHelpPrintf)(comm,"%sn",version);
440:     (*PetscHelpPrintf)(comm,"%s",PETSC_AUTHOR_INFO);
441:     (*PetscHelpPrintf)(comm,"See docs/copyright.html for copyright informationn");
442:     (*PetscHelpPrintf)(comm,"See docs/changes/index.html for recent updates.n");
443:     (*PetscHelpPrintf)(comm,"See docs/troubleshooting.html for problems.n");
444:     (*PetscHelpPrintf)(comm,"See docs/manualpages/index.html for help. n");
445: #if !defined(PARCH_win32)
446:     (*PetscHelpPrintf)(comm,"Libraries linked from %sn",PETSC_LIB_DIR);
447: #endif
448:     (*PetscHelpPrintf)(comm,"--------------------------------------------
449: ------------------------------n");
450:   }

452:   /*
453:        Print "higher-level" package help message 
454:   */
455:   if (flg3){
456:     if (PetscExternalHelpFunction) {
457:       (*PetscExternalHelpFunction)(comm);
458:     }
459:   }

461:   /*
462:       Setup the error handling
463:   */
464:   PetscOptionsHasName(PETSC_NULL,"-fp_trap",&flg1);
465:   if (flg1) { PetscSetFPTrap(PETSC_FP_TRAP_ON); }
466:   PetscOptionsHasName(PETSC_NULL,"-on_error_abort",&flg1);
467:   if (flg1) { PetscPushErrorHandler(PetscAbortErrorHandler,0);CHKERRQ(ierr)}
468:   PetscOptionsHasName(PETSC_NULL,"-on_error_stop",&flg1);
469:   if (flg1) { PetscPushErrorHandler(PetscStopErrorHandler,0);CHKERRQ(ierr)}
470:   PetscOptionsHasName(PETSC_NULL,"-mpi_return_on_error",&flg1);
471:   if (flg1) {
472:     MPI_Errhandler_set(comm,MPI_ERRORS_RETURN);
473:   }
474:   PetscOptionsHasName(PETSC_NULL,"-no_signal_handler",&flg1);
475:   if (!flg1) { PetscPushSignalHandler(PetscDefaultSignalHandler,(void*)0);CHKERRQ(ierr) }

477:   /*
478:       Setup debugger information
479:   */
480:   PetscSetDefaultDebugger();
481:   PetscOptionsGetString(PETSC_NULL,"-on_error_attach_debugger",string,64,&flg1);
482:   if (flg1) {
483:     MPI_Errhandler err_handler;

485:     PetscSetDebuggerFromString(string);
486:     MPI_Errhandler_create((MPI_Handler_function*)Petsc_MPI_DebuggerOnError,&err_handler);
487:     MPI_Errhandler_set(comm,err_handler);
488:     PetscPushErrorHandler(PetscAttachDebuggerErrorHandler,0);
489:   }
490:   PetscOptionsGetString(PETSC_NULL,"-start_in_debugger",string,64,&flg1);
491:   PetscOptionsGetString(PETSC_NULL,"-stop_for_debugger",string,64,&flg2);
492:   if (flg1 || flg2) {
493:     int            size;
494:     MPI_Errhandler err_handler;
495:     /*
496:        we have to make sure that all processors have opened 
497:        connections to all other processors, otherwise once the 
498:        debugger has stated it is likely to receive a SIGUSR1
499:        and kill the program. 
500:     */
501:     MPI_Comm_size(PETSC_COMM_WORLD,&size);
502:     if (size > 2) {
503:       int        dummy;
504:       MPI_Status status;
505:       for (i=0; i<size; i++) {
506:         MPI_Send(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD);
507:       }
508:       for (i=0; i<size; i++) {
509:         MPI_Recv(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD,&status);
510:       }
511:     }
512:     /* check if this processor node should be in debugger */
513:     PetscMalloc(size*sizeof(int),&nodes);
514:     PetscOptionsGetIntArray(PETSC_NULL,"-debugger_nodes",nodes,&size,&flag);
515:     if (flag) {
516:       for (i=0; i<size; i++) {
517:         if (nodes[i] == rank) { flag = PETSC_FALSE; break; }
518:       }
519:     }
520:     if (!flag) {
521:       PetscSetDebuggerFromString(string);
522:       PetscPushErrorHandler(PetscAbortErrorHandler,0);
523:       if (flg1) {
524:         PetscAttachDebugger();
525:       } else {
526:         PetscStopForDebugger();
527:       }
528:       MPI_Errhandler_create((MPI_Handler_function*)Petsc_MPI_AbortOnError,&err_handler);
529:       MPI_Errhandler_set(comm,err_handler);
530:     }
531:     PetscFree(nodes);
532:   }

534:   PetscOptionsGetString(PETSC_NULL,"-on_error_emacs",emacsmachinename,128,&flg1);
535:   if (flg1 && !rank) {PetscPushErrorHandler(PetscEmacsClientErrorHandler,emacsmachinename);CHKERRQ(ierr)}

537:   /*
538:         Setup profiling and logging
539:   */
540: #if defined(PETSC_USE_LOG)
541:   mname[0] = 0;
542:   PetscOptionsGetString(PETSC_NULL,"-log_history",mname,PETSC_MAX_PATH_LEN,&flg1);
543:   if (flg1) {
544:     if (mname[0]) {
545:       PetscLogOpenHistoryFile(mname,&petsc_history);
546:     } else {
547:       PetscLogOpenHistoryFile(0,&petsc_history);
548:     }
549:   }
550:   PetscOptionsHasName(PETSC_NULL,"-log_info",&flg1);
551:   if (flg1) {
552:     char logname[PETSC_MAX_PATH_LEN]; logname[0] = 0;
553:     PetscOptionsGetString(PETSC_NULL,"-log_info",logname,250,&flg1);
554:     if (logname[0]) {
555:       PetscLogInfoAllow(PETSC_TRUE,logname);
556:     } else {
557:       PetscLogInfoAllow(PETSC_TRUE,PETSC_NULL);
558:     }
559:   }
560: #if defined(PETSC_HAVE_MPE)
561:   PetscOptionsHasName(PETSC_NULL,"-log_mpe",&flg1);
562:   if (flg1) PetscLogMPEBegin();
563: #endif
564:   PetscOptionsHasName(PETSC_NULL,"-log_all",&flg1);
565:   PetscOptionsHasName(PETSC_NULL,"-log",&flg2);
566:   PetscOptionsHasName(PETSC_NULL,"-log_summary",&flg3);
567:   if (flg1)              {  PetscLogAllBegin(); }
568:   else if (flg2 || flg3) {  PetscLogBegin();}
569: 
570:   PetscOptionsGetString(PETSC_NULL,"-log_trace",mname,250,&flg1);
571:   if (flg1) {
572:     char name[PETSC_MAX_PATH_LEN],fname[PETSC_MAX_PATH_LEN];
573:     FILE *file;
574:     if (mname[0]) {
575:       sprintf(name,"%s.%d",mname,rank);
576:       PetscFixFilename(name,fname);
577:       file = fopen(fname,"w");
578:       if (!file) {
579:         SETERRQ1(PETSC_ERR_FILE_OPEN,"Unable to open trace file: %s",fname);
580:       }
581:     } else {
582:       file = stdout;
583:     }
584:     PetscLogTraceBegin(file);
585:   }
586: #endif

588:   /*
589:       Setup building of stack frames for all function calls
590:   */
591: #if defined(PETSC_USE_STACK)
592: #if defined(PETSC_USE_BOPT_g)
593:   PetscStackCreate();
594: #else
595:   PetscOptionsHasName(PETSC_NULL,"-log_stack",&flg1);
596:   if (flg1) {
597:     PetscStackCreate();
598:   }
599: #endif
600: #endif


603:   /*
604:        Print basic help message
605:   */
606:   PetscOptionsHasName(PETSC_NULL,"-help",&flg1);
607:   if (flg1) {
608:     (*PetscHelpPrintf)(comm,"Options for all PETSc programs:n");
609:     (*PetscHelpPrintf)(comm," -on_error_abort: cause an abort when an error is");
610:     (*PetscHelpPrintf)(comm," detected. Useful n       only when run in the debuggern");
611:     (*PetscHelpPrintf)(comm," -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm]n");
612:     (*PetscHelpPrintf)(comm,"       start the debugger in new xtermn");
613:     (*PetscHelpPrintf)(comm,"       unless noxterm is givenn");
614:     (*PetscHelpPrintf)(comm," -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm]n");
615:     (*PetscHelpPrintf)(comm,"       start all processes in the debuggern");
616:     (*PetscHelpPrintf)(comm," -on_error_emacs <machinename>n");
617:     (*PetscHelpPrintf)(comm,"    emacs jumps to error filen");
618:     (*PetscHelpPrintf)(comm," -debugger_nodes [n1,n2,..] Nodes to start in debuggern");
619:     (*PetscHelpPrintf)(comm," -debugger_pause [m] : delay (in seconds) to attach debuggern");
620:     (*PetscHelpPrintf)(comm," -stop_for_debugger : prints message on how to attach debugger manuallyn");
621:     (*PetscHelpPrintf)(comm,"                      waits the delay for you to attachn");
622:     (*PetscHelpPrintf)(comm," -display display: Location where graphics and debuggers are displayedn");
623:     (*PetscHelpPrintf)(comm," -no_signal_handler: do not trap error signalsn");
624:     (*PetscHelpPrintf)(comm," -mpi_return_on_error: MPI returns error code, rather than abort on internal errorn");
625:     (*PetscHelpPrintf)(comm," -fp_trap: stop on floating point exceptionsn");
626:     (*PetscHelpPrintf)(comm,"           note on IBM RS6000 this slows run greatlyn");
627:     (*PetscHelpPrintf)(comm," -trdump <optional filename>: dump list of unfreed memory at conclusionn");
628:     (*PetscHelpPrintf)(comm," -trmalloc: use our error checking mallocn");
629:     (*PetscHelpPrintf)(comm," -trmalloc no: don't use error checking mallocn");
630:     (*PetscHelpPrintf)(comm," -trinfo: prints total memory usagen");
631:     (*PetscHelpPrintf)(comm," -trdebug: enables extended checking for memory corruptionn");
632:     (*PetscHelpPrintf)(comm," -options_table: dump list of options inputtedn");
633:     (*PetscHelpPrintf)(comm," -options_left: dump list of unused optionsn");
634:     (*PetscHelpPrintf)(comm," -options_left no: don't dump list of unused optionsn");
635:     (*PetscHelpPrintf)(comm," -tmp tmpdir: alternative /tmp directoryn");
636:     (*PetscHelpPrintf)(comm," -shared_tmp: tmp directory is shared by all processorsn");
637:     (*PetscHelpPrintf)(comm," -not_shared_tmp: each processor has seperate tmp directoryn");
638:     (*PetscHelpPrintf)(comm," -get_resident_set_size: print memory usage at end of runn");
639: #if defined(PETSC_USE_LOG)
640:     (*PetscHelpPrintf)(comm," -get_total_flops: total flops over all processorsn");
641:     (*PetscHelpPrintf)(comm," -log[_all _summary]: logging objects and eventsn");
642:     (*PetscHelpPrintf)(comm," -log_trace [filename]: prints trace of all PETSc callsn");
643: #if defined(PETSC_HAVE_MPE)
644:     (*PetscHelpPrintf)(comm," -log_mpe: Also create logfile viewable through upshotn");
645: #endif
646:     (*PetscHelpPrintf)(comm," -log_info <optional filename>: print informative messages about the calculationsn");
647: #endif
648:     (*PetscHelpPrintf)(comm," -v: prints PETSc version number and release daten");
649:     (*PetscHelpPrintf)(comm," -options_file <file>: reads options from filen");
650:     (*PetscHelpPrintf)(comm," -petsc_sleep n: sleeps n seconds before running programn");
651: #if defined(PETSC_HAVE_AMS)
652:     (*PetscHelpPrintf)(comm," -ams_publish_objects: n");
653:     (*PetscHelpPrintf)(comm," -ams_publish_stack: n");
654: #endif
655:     (*PetscHelpPrintf)(comm,"-----------------------------------------------n");
656:   }

658:   /*
659:       Setup advanced compare feature for allowing comparison to two running PETSc programs
660:   */
661:   PetscOptionsHasName(PETSC_NULL,"-compare",&flg1);
662:   if (flg1) {
663:      PetscReal tol = 1.e-12;
664:      PetscOptionsGetReal(PETSC_NULL,"-compare",&tol,&flg1);
665:      PetscCompareInitialize(tol);
666:   }
667:   PetscOptionsGetInt(PETSC_NULL,"-petsc_sleep",&i,&flg1);
668:   if (flg1) {
669:     PetscSleep(i);
670:   }

672:   PetscOptionsGetString(PETSC_NULL,"-log_info_exclude",mname,PETSC_MAX_PATH_LEN,&flg1);
673:   PetscStrstr(mname,"null",&f);
674:   if (f) {
675:     PetscLogInfoDeactivateClass(PETSC_NULL);
676:   }

678:   return(0);
679: }