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

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

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

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

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

 68: int PetscLogOpenHistoryFile(const char filename[],FILE **fd)
 69: {
 70:   int  ierr,rank,size;
 71:   char pfile[256],pname[256],fname[256],date[64];
 72:   char version[256];

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

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

102: int PetscLogCloseHistoryFile(FILE **fd)
103: {
104:   int  rank,ierr;
105:   char date[64];

108:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
109:   if (rank) return(0);
110:   PetscGetDate(date,64);
111:   fprintf(*fd,"---------------------------------------------------------n");
112:   fprintf(*fd,"Finished at %sn",date);
113:   fprintf(*fd,"---------------------------------------------------------n");
114:   fflush(*fd);
115:   fclose(*fd);
116:   return(0);
117: }

119: /* ------------------------------------------------------------------------------*/

121: PetscTruth PetscCompare          = PETSC_FALSE;
122: PetscReal  PetscCompareTolerance = 1.e-10;

124: /*@C
125:    PetscCompareInt - Compares integers while running with PETScs incremental
126:    debugger.

128:    Collective on PETSC_COMM_WORLD

130:    Input Parameter:
131: .  d - integer to compare

133:    Options Database Key:
134: .  -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()

136:    Level: advanced

138: .seealso: PetscCompareDouble(), PetscCompareScalar()
139: @*/
140: int PetscCompareInt(int d)
141: {
142:   int work = d,ierr;

145:   MPI_Bcast(&work,1,MPI_INT,0,MPI_COMM_WORLD);
146:   if (d != work) {
147:     SETERRQ(PETSC_ERR_PLIB,"Inconsistent integer");
148:   }
149:   return(0);
150: }

152: /*@C
153:    PetscCompareDouble - Compares doubles while running with PETScs incremental
154:    debugger.

156:    Collective on PETSC_COMM_WORLD

158:    Input Parameter:
159: .  d - double precision number to compare

161:    Options Database Key:
162: .  -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()

164:    Level: advanced

166: .seealso: PetscCompareInt(), PetscComparseScalar()
167: @*/
168: int PetscCompareDouble(double d)
169: {
170:   double work = d;
171:   int    ierr;

174:   MPI_Bcast(&work,1,MPIU_REAL,0,MPI_COMM_WORLD);
175:   if (!d && !work) return(0);
176:   if (PetscAbsReal(work - d)/PetscMax(PetscAbsReal(d),PetscAbsReal(work)) > PetscCompareTolerance) {
177:     SETERRQ(PETSC_ERR_PLIB,"Inconsistent double");
178:   }
179:   return(0);
180: }

182: /*@C
183:    PetscCompareScalar - Compares scalars while running with PETScs incremental
184:    debugger.

186:    Collective on PETSC_COMM_WORLD

188:    Input Parameter:
189: .  d - scalar to compare

191:    Options Database Key:
192: .  -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()

194:    Level: advanced

196: .seealso: PetscCompareInt(), PetscComparseDouble()
197: @*/
198: int PetscCompareScalar(PetscScalar d)
199: {
200:   PetscScalar work = d;
201:   int         ierr;

204:   MPI_Bcast(&work,2,MPIU_REAL,0,MPI_COMM_WORLD);
205:   if (!PetscAbsScalar(d) && !PetscAbsScalar(work)) return(0);
206:   if (PetscAbsScalar(work - d)/PetscMax(PetscAbsScalar(d),PetscAbsScalar(work)) >= PetscCompareTolerance) {
207:     SETERRQ(PETSC_ERR_PLIB,"Inconsistent scalar");
208:   }
209:   return(0);
210: }

212: /*
213:     PetscCompareInitialize - If there is a command line option -compare then
214:     this routine calls MPI_Init() and sets up two PETSC_COMM_WORLD, one for 
215:     each program being compared.

217:     Note: 
218:     Only works with C programs.
219: */
220: int PetscCompareInitialize(double tol)
221: {
222:   int        ierr,i,len,rank,*gflag,size,mysize;
223:   char       pname[256],basename[256];
224:   MPI_Group  group_all,group_sub;
225:   PetscTruth work;

228:   PetscGetProgramName(pname,256);
229:   PetscCompareTolerance = tol;

231:   MPI_Comm_rank(MPI_COMM_WORLD,&rank);
232:   MPI_Comm_size(MPI_COMM_WORLD,&size);
233:   if (!rank) {
234:     PetscStrcpy(basename,pname);
235:     PetscStrlen(basename,&len);
236:   }

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

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

245:   gflag = (int*)malloc(size*sizeof(int));
246:   MPI_Allgather(&work,1,MPI_INT,gflag,1,MPI_INT,MPI_COMM_WORLD);
247:   mysize = 0;
248:   for (i=0; i<size; i++) {
249:     if (work == gflag[i]) gflag[mysize++] = i;
250:   }
251:   /* printf("[%d] my name %s basename %s mysize %dn",rank,programname,basename,mysize); */

253:   if (!mysize || mysize == size) {
254:     SETERRQ(PETSC_ERR_ARG_IDN,"Need two different programs to compare");
255:   }

257:   /* create a new communicator for each program */
258:   MPI_Comm_group(MPI_COMM_WORLD,&group_all);
259:   MPI_Group_incl(group_all,mysize,gflag,&group_sub);
260:   MPI_Comm_create(MPI_COMM_WORLD,group_sub,&PETSC_COMM_WORLD);
261:   MPI_Group_free(&group_all);
262:   MPI_Group_free(&group_sub);
263:   free(gflag);

265:   PetscCompare = PETSC_TRUE;
266:   PetscLogInfo(0,"PetscCompareInitialize:Configured to compare two programsn");
267:   return(0);
268: }
269: /* ------------------------------------------------------------------------------------*/

271: 
272: /* 
273:    This is ugly and probably belongs somewhere else, but I want to 
274:   be able to put a true MPI abort error handler with command line args.

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

280: void Petsc_MPI_AbortOnError(MPI_Comm *comm,int *flag)
281: {
283:   (*PetscErrorPrintf)("MPI error %dn",*flag);
284:   abort();
285: }

287: void Petsc_MPI_DebuggerOnError(MPI_Comm *comm,int *flag)
288: {

292:   (*PetscErrorPrintf)("MPI error %dn",*flag);
293:   PetscAttachDebugger();
294:   if (ierr) { /* hopeless so get out */
295:     MPI_Finalize();
296:     exit(*flag);
297:   }
298: }

300: /*@C 
301:    PetscEnd - Calls PetscFinalize() and then ends the program. This is useful if one 
302:      wishes a clean exit somewhere deep in the program.

304:    Collective on PETSC_COMM_WORLD

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

308:    Level: advanced

310:    Note:
311:    See PetscInitialize() for more general runtime options.

313: .seealso: PetscInitialize(), PetscOptionsPrint(), PetscTrDump(), PetscMPIDump(), PetscFinalize()
314: @*/
315: int PetscEnd(void)
316: {
318:   PetscFinalize();
319:   exit(0);
320:   return 0;
321: }

323: PetscTruth        PetscOptionsPublish = PETSC_FALSE;
324: EXTERN int        PetscLogInfoAllow(PetscTruth,char *);
325: EXTERN int        PetscSetUseTrMalloc_Private(void);
326: extern PetscTruth petscsetmallocvisited;
327: static char       emacsmachinename[128];

329: int (*PetscExternalVersionFunction)(MPI_Comm) = 0;
330: int (*PetscExternalHelpFunction)(MPI_Comm)    = 0;

332: /*@C 
333:    PetscSetHelpVersionFunctions - Sets functions that print help and version information
334:    before the PETSc help and version information is printed. Must call BEFORE PetscInitialize().
335:    This routine enables a "higher-level" package that uses PETSc to print its messages first.

337:    Input Parameter:
338: +  help - the help function (may be PETSC_NULL)
339: -  version - the version function (may be PETSc null)

341:    Level: developer

343:    Concepts: package help message

345: @*/
346: int PetscSetHelpVersionFunctions(int (*help)(MPI_Comm),int (*version)(MPI_Comm))
347: {
349:   PetscExternalHelpFunction    = help;
350:   PetscExternalVersionFunction = version;
351:   return(0);
352: }

354: int PetscOptionsCheckInitial(void)
355: {
356:   char       string[64],mname[256],*f;
357:   MPI_Comm   comm = PETSC_COMM_WORLD;
358:   PetscTruth flg1,flg2,flg3,flag;
359:   int        ierr,*nodes,i,rank;
360:   char       version[256];

363:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);

365: #if defined(PETSC_HAVE_AMS)
366:   PetscOptionsHasName(PETSC_NULL,"-ams_publish_options",&flg3);
367:   if (flg3) PetscOptionsPublish = PETSC_TRUE;
368: #endif

370:   /*
371:       Setup the memory management; support for tracing malloc() usage 
372:   */
373:   PetscOptionsHasName(PETSC_NULL,"-trmalloc_log",&flg3);
374: #if defined(PETSC_USE_BOPT_g)
375:   /* always does trmalloc with BOPT=g, just check so does not reported never checked */
376:   PetscOptionsHasName(PETSC_NULL,"-trmalloc",&flg1);
377:   PetscOptionsHasName(PETSC_NULL,"-trmalloc_off",&flg1);
378:   if (!flg1 && !petscsetmallocvisited) {
379:     PetscSetUseTrMalloc_Private();
380:   }
381: #else
382:   PetscOptionsHasName(PETSC_NULL,"-trdump",&flg1);
383:   PetscOptionsHasName(PETSC_NULL,"-trmalloc",&flg2);
384:   if (flg1 || flg2 || flg3) {PetscSetUseTrMalloc_Private();}
385: #endif
386:   if (flg3) {
387:     PetscTrLog();
388:   }
389:   PetscOptionsHasName(PETSC_NULL,"-trdebug",&flg1);
390:   if (flg1) {
391:     PetscTrDebugLevel(1);
392:   }

394:   /*
395:       Set the display variable for graphics
396:   */
397:   PetscSetDisplay();

399:   /*
400:       Print the PETSc version information
401:   */
402:   PetscOptionsHasName(PETSC_NULL,"-v",&flg1);
403:   PetscOptionsHasName(PETSC_NULL,"-version",&flg2);
404:   PetscOptionsHasName(PETSC_NULL,"-help",&flg3);
405:   if (flg1 || flg2 || flg3){

407:     /*
408:        Print "higher-level" package version message 
409:     */
410:     if (PetscExternalVersionFunction) {
411:       (*PetscExternalVersionFunction)(comm);
412:     }

414:     PetscGetVersion(&version);
415:     (*PetscHelpPrintf)(comm,"--------------------------------------------
416: ------------------------------n");
417:     (*PetscHelpPrintf)(comm,"%sn",version);
418:     (*PetscHelpPrintf)(comm,"%s",PETSC_AUTHOR_INFO);
419:     (*PetscHelpPrintf)(comm,"See docs/copyright.html for copyright informationn");
420:     (*PetscHelpPrintf)(comm,"See docs/changes/index.html for recent updates.n");
421:     (*PetscHelpPrintf)(comm,"See docs/troubleshooting.html for problems.n");
422:     (*PetscHelpPrintf)(comm,"See docs/manualpages/index.html for help. n");
423: #if !defined(PARCH_win32)
424:     (*PetscHelpPrintf)(comm,"Libraries linked from %sn",PETSC_LIB_DIR);
425: #endif
426:     (*PetscHelpPrintf)(comm,"--------------------------------------------
427: ------------------------------n");
428:   }

430:   /*
431:        Print "higher-level" package help message 
432:   */
433:   if (flg3){
434:     if (PetscExternalHelpFunction) {
435:       (*PetscExternalHelpFunction)(comm);
436:     }
437:   }

439:   /*
440:       Setup the error handling
441:   */
442:   PetscOptionsHasName(PETSC_NULL,"-fp_trap",&flg1);
443:   if (flg1) { PetscSetFPTrap(PETSC_FP_TRAP_ON); }
444:   PetscOptionsHasName(PETSC_NULL,"-on_error_abort",&flg1);
445:   if (flg1) { PetscPushErrorHandler(PetscAbortErrorHandler,0);CHKERRQ(ierr)}
446:   PetscOptionsHasName(PETSC_NULL,"-on_error_stop",&flg1);
447:   if (flg1) { PetscPushErrorHandler(PetscStopErrorHandler,0);CHKERRQ(ierr)}
448:   PetscOptionsHasName(PETSC_NULL,"-mpi_return_on_error",&flg1);
449:   if (flg1) {
450:     MPI_Errhandler_set(comm,MPI_ERRORS_RETURN);
451:   }
452:   PetscOptionsHasName(PETSC_NULL,"-no_signal_handler",&flg1);
453:   if (!flg1) { PetscPushSignalHandler(PetscDefaultSignalHandler,(void*)0);CHKERRQ(ierr) }

455:   /*
456:       Setup debugger information
457:   */
458:   PetscSetDefaultDebugger();
459:   PetscOptionsGetString(PETSC_NULL,"-on_error_attach_debugger",string,64,&flg1);
460:   if (flg1) {
461:     MPI_Errhandler err_handler;

463:     PetscSetDebuggerFromString(string);
464:     MPI_Errhandler_create((MPI_Handler_function*)Petsc_MPI_DebuggerOnError,&err_handler);
465:     MPI_Errhandler_set(comm,err_handler);
466:     PetscPushErrorHandler(PetscAttachDebuggerErrorHandler,0);
467:   }
468:   PetscOptionsGetString(PETSC_NULL,"-start_in_debugger",string,64,&flg1);
469:   PetscOptionsGetString(PETSC_NULL,"-stop_for_debugger",string,64,&flg2);
470:   if (flg1 || flg2) {
471:     int            size;
472:     MPI_Errhandler err_handler;
473:     /*
474:        we have to make sure that all processors have opened 
475:        connections to all other processors, otherwise once the 
476:        debugger has stated it is likely to receive a SIGUSR1
477:        and kill the program. 
478:     */
479:     MPI_Comm_size(PETSC_COMM_WORLD,&size);
480:     if (size > 2) {
481:       int        dummy;
482:       MPI_Status status;
483:       for (i=0; i<size; i++) {
484:         MPI_Send(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD);
485:       }
486:       for (i=0; i<size; i++) {
487:         MPI_Recv(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD,&status);
488:       }
489:     }
490:     /* check if this processor node should be in debugger */
491:     PetscMalloc(size*sizeof(int),&nodes);
492:     PetscOptionsGetIntArray(PETSC_NULL,"-debugger_nodes",nodes,&size,&flag);
493:     if (flag) {
494:       for (i=0; i<size; i++) {
495:         if (nodes[i] == rank) { flag = PETSC_FALSE; break; }
496:       }
497:     }
498:     if (!flag) {
499:       PetscSetDebuggerFromString(string);
500:       PetscPushErrorHandler(PetscAbortErrorHandler,0);
501:       if (flg1) {
502:         PetscAttachDebugger();
503:       } else {
504:         PetscStopForDebugger();
505:       }
506:       MPI_Errhandler_create((MPI_Handler_function*)Petsc_MPI_AbortOnError,&err_handler);
507:       MPI_Errhandler_set(comm,err_handler);
508:     }
509:     PetscFree(nodes);
510:   }

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

515:   /*
516:         Setup profiling and logging
517:   */
518: #if defined(PETSC_USE_LOG)
519:   mname[0] = 0;
520:   PetscOptionsGetString(PETSC_NULL,"-log_history",mname,256,&flg1);
521:   if (flg1) {
522:     if (mname[0]) {
523:       PetscLogOpenHistoryFile(mname,&petsc_history);
524:     } else {
525:       PetscLogOpenHistoryFile(0,&petsc_history);
526:     }
527:   }
528:   PetscOptionsHasName(PETSC_NULL,"-log_info",&flg1);
529:   if (flg1) {
530:     char logname[256]; logname[0] = 0;
531:     PetscOptionsGetString(PETSC_NULL,"-log_info",logname,250,&flg1);
532:     if (logname[0]) {
533:       PetscLogInfoAllow(PETSC_TRUE,logname);
534:     } else {
535:       PetscLogInfoAllow(PETSC_TRUE,PETSC_NULL);
536:     }
537:   }
538: #if defined(PETSC_HAVE_MPE)
539:   PetscOptionsHasName(PETSC_NULL,"-log_mpe",&flg1);
540:   if (flg1) PetscLogMPEBegin();
541: #endif
542:   PetscOptionsHasName(PETSC_NULL,"-log_all",&flg1);
543:   PetscOptionsHasName(PETSC_NULL,"-log",&flg2);
544:   PetscOptionsHasName(PETSC_NULL,"-log_summary",&flg3);
545:   if (flg1)              {  PetscLogAllBegin(); }
546:   else if (flg2 || flg3) {  PetscLogBegin();}
547: 
548:   PetscOptionsGetString(PETSC_NULL,"-log_trace",mname,250,&flg1);
549:   if (flg1) {
550:     char name[256],fname[256];
551:     FILE *file;
552:     if (mname[0]) {
553:       sprintf(name,"%s.%d",mname,rank);
554:       PetscFixFilename(name,fname);
555:       file = fopen(fname,"w");
556:       if (!file) {
557:         SETERRQ1(PETSC_ERR_FILE_OPEN,"Unable to open trace file: %s",fname);
558:       }
559:     } else {
560:       file = stdout;
561:     }
562:     PetscLogTraceBegin(file);
563:   }
564: #endif

566:   /*
567:       Setup building of stack frames for all function calls
568:   */
569: #if defined(PETSC_USE_STACK)
570: #if defined(PETSC_USE_BOPT_g)
571:   PetscStackCreate();
572: #else
573:   PetscOptionsHasName(PETSC_NULL,"-log_stack",&flg1);
574:   if (flg1) {
575:     PetscStackCreate();
576:   }
577: #endif
578: #endif


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

636:   /*
637:       Setup advanced compare feature for allowing comparison to two running PETSc programs
638:   */
639:   PetscOptionsHasName(PETSC_NULL,"-compare",&flg1);
640:   if (flg1) {
641:      PetscReal tol = 1.e-12;
642:      PetscOptionsGetReal(PETSC_NULL,"-compare",&tol,&flg1);
643:      PetscCompareInitialize(tol);
644:   }
645:   PetscOptionsGetInt(PETSC_NULL,"-petsc_sleep",&i,&flg1);
646:   if (flg1) {
647:     PetscSleep(i);
648:   }

650:   PetscOptionsGetString(PETSC_NULL,"-log_info_exclude",mname,256,&flg1);
651:   PetscStrstr(mname,"null",&f);
652:   if (f) {
653:     PetscLogInfoDeactivateClass(PETSC_NULL);
654:   }

656:   return(0);
657: }