Actual source code: init.c

petsc-3.4.5 2014-06-29
  1: /*

  3:    This file defines part of the initialization of PETSc

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

  9: #define PETSC_DESIRE_COMPLEX
 10: #include <petscsys.h>        /*I  "petscsys.h"   I*/
 11: #include <petscviewer.h>

 13: #if defined(PETSC_HAVE_SYS_SYSINFO_H)
 14: #include <sys/sysinfo.h>
 15: #endif
 16: #if defined(PETSC_HAVE_UNISTD_H)
 17: #include <unistd.h>
 18: #endif

 20: /* ------------------------Nasty global variables -------------------------------*/
 21: /*
 22:      Indicates if PETSc started up MPI, or it was
 23:    already started before PETSc was initialized.
 24: */
 25: PetscBool   PetscBeganMPI         = PETSC_FALSE;
 26: PetscBool   PetscInitializeCalled = PETSC_FALSE;
 27: PetscBool   PetscFinalizeCalled   = PETSC_FALSE;

 29: PetscMPIInt PetscGlobalRank       = -1;
 30: PetscMPIInt PetscGlobalSize       = -1;

 32: #if defined(PETSC_HAVE_COMPLEX)
 33: #if defined(PETSC_COMPLEX_INSTANTIATE)
 34: template <> class std::complex<double>; /* instantiate complex template class */
 35: #endif
 36: #if !defined(PETSC_HAVE_MPI_C_DOUBLE_COMPLEX)
 37: MPI_Datatype MPIU_C_DOUBLE_COMPLEX;
 38: MPI_Datatype MPIU_C_COMPLEX;
 39: #endif

 41: /*MC
 42:    PETSC_i - the imaginary number i

 44:    Synopsis:
 45:    #define PETSC_DESIRE_COMPLEX
 46:    #include <petscsys.h>
 47:    PetscComplex PETSC_i;

 49:    Level: beginner

 51:    Note:
 52:    Complex numbers are automatically available if PETSc was configured --with-scalar-type=complex (in which case
 53:    PetscComplex will match PetscScalar), otherwise the macro PETSC_DESIRE_COMPLEX must be defined before including any
 54:    PETSc headers. If the compiler supports complex numbers, PetscComplex and associated variables and functions will be
 55:    defined and PETSC_HAVE_COMPLEX will be set.

 57: .seealso: PetscRealPart(), PetscImaginaryPart(), PetscRealPartComplex(), PetscImaginaryPartComplex()
 58: M*/
 59: PetscComplex PETSC_i;
 60: #endif
 61: #if defined(PETSC_USE_REAL___FLOAT128)
 62: MPI_Datatype MPIU___FLOAT128 = 0;
 63: #if defined(PETSC_HAVE_COMPLEX)
 64: MPI_Datatype MPIU___COMPLEX128 = 0;
 65: #endif
 66: #endif
 67: MPI_Datatype MPIU_2SCALAR = 0;
 68: #if defined(PETSC_USE_64BIT_INDICES) || !defined(MPI_2INT)
 69: MPI_Datatype MPIU_2INT = 0;
 70: #endif
 71: MPI_Datatype MPIU_BOOL;
 72: MPI_Datatype MPIU_ENUM;

 74: /*
 75:        Function that is called to display all error messages
 76: */
 77: PetscErrorCode (*PetscErrorPrintf)(const char [],...)          = PetscErrorPrintfDefault;
 78: PetscErrorCode (*PetscHelpPrintf)(MPI_Comm,const char [],...)  = PetscHelpPrintfDefault;
 79: #if defined(PETSC_HAVE_MATLAB_ENGINE)
 80: PetscErrorCode (*PetscVFPrintf)(FILE*,const char[],va_list)    = PetscVFPrintf_Matlab;
 81: #else
 82: PetscErrorCode (*PetscVFPrintf)(FILE*,const char[],va_list)    = PetscVFPrintfDefault;
 83: #endif
 84: /*
 85:   This is needed to turn on/off cusp synchronization
 86: */
 87: PetscBool PetscCUSPSynchronize = PETSC_FALSE;

 89: /* ------------------------------------------------------------------------------*/
 90: /*
 91:    Optional file where all PETSc output from various prints is saved
 92: */
 93: FILE *petsc_history = NULL;

 97: PetscErrorCode  PetscOpenHistoryFile(const char filename[],FILE **fd)
 98: {
100:   PetscMPIInt    rank,size;
101:   char           pfile[PETSC_MAX_PATH_LEN],pname[PETSC_MAX_PATH_LEN],fname[PETSC_MAX_PATH_LEN],date[64];
102:   char           version[256];

105:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
106:   if (!rank) {
107:     char        arch[10];
108:     int         err;
109:     PetscViewer viewer;

111:     PetscGetArchType(arch,10);
112:     PetscGetDate(date,64);
113:     PetscGetVersion(version,256);
114:     MPI_Comm_size(PETSC_COMM_WORLD,&size);
115:     if (filename) {
116:       PetscFixFilename(filename,fname);
117:     } else {
118:       PetscGetHomeDirectory(pfile,240);
119:       PetscStrcat(pfile,"/.petschistory");
120:       PetscFixFilename(pfile,fname);
121:     }

123:     *fd = fopen(fname,"a");
124:     if (!fd) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Cannot open file: %s",fname);

126:     PetscFPrintf(PETSC_COMM_SELF,*fd,"---------------------------------------------------------\n");
127:     PetscFPrintf(PETSC_COMM_SELF,*fd,"%s %s\n",version,date);
128:     PetscGetProgramName(pname,PETSC_MAX_PATH_LEN);
129:     PetscFPrintf(PETSC_COMM_SELF,*fd,"%s on a %s, %d proc. with options:\n",pname,arch,size);
130:     PetscViewerASCIIOpenWithFILE(PETSC_COMM_WORLD,*fd,&viewer);
131:     PetscOptionsView(viewer);
132:     PetscViewerDestroy(&viewer);
133:     PetscFPrintf(PETSC_COMM_SELF,*fd,"---------------------------------------------------------\n");

135:     err = fflush(*fd);
136:     if (err) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SYS,"fflush() failed on file");
137:   }
138:   return(0);
139: }

143: PetscErrorCode  PetscCloseHistoryFile(FILE **fd)
144: {
146:   PetscMPIInt    rank;
147:   char           date[64];
148:   int            err;

151:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
152:   if (!rank) {
153:     PetscGetDate(date,64);
154:     PetscFPrintf(PETSC_COMM_SELF,*fd,"---------------------------------------------------------\n");
155:     PetscFPrintf(PETSC_COMM_SELF,*fd,"Finished at %s\n",date);
156:     PetscFPrintf(PETSC_COMM_SELF,*fd,"---------------------------------------------------------\n");
157:     err  = fflush(*fd);
158:     if (err) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SYS,"fflush() failed on file");
159:     err = fclose(*fd);
160:     if (err) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SYS,"fclose() failed on file");
161:   }
162:   return(0);
163: }

165: /* ------------------------------------------------------------------------------*/

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

171:     This is so MPI errors in the debugger will leave all the stack
172:   frames. The default MP_Abort() cleans up and exits thus providing no useful information
173:   in the debugger hence we call abort() instead of MPI_Abort().
174: */

178: void Petsc_MPI_AbortOnError(MPI_Comm *comm,PetscMPIInt *flag)
179: {
181:   (*PetscErrorPrintf)("MPI error %d\n",*flag);
182:   abort();
183: }

187: void Petsc_MPI_DebuggerOnError(MPI_Comm *comm,PetscMPIInt *flag)
188: {

192:   (*PetscErrorPrintf)("MPI error %d\n",*flag);
193:   PetscAttachDebugger();
194:   if (ierr) MPI_Abort(*comm,*flag); /* hopeless so get out */
195: }

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

203:    Collective on PETSC_COMM_WORLD

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

207:    Level: advanced

209:    Note:
210:    See PetscInitialize() for more general runtime options.

212: .seealso: PetscInitialize(), PetscOptionsView(), PetscMallocDump(), PetscMPIDump(), PetscFinalize()
213: @*/
214: PetscErrorCode  PetscEnd(void)
215: {
217:   PetscFinalize();
218:   exit(0);
219:   return 0;
220: }

222: PetscBool PetscOptionsPublish = PETSC_FALSE;
223: extern PetscErrorCode PetscSetUseTrMalloc_Private(void);
224: extern PetscBool      petscsetmallocvisited;
225: static char           emacsmachinename[256];

227: PetscErrorCode (*PetscExternalVersionFunction)(MPI_Comm) = 0;
228: PetscErrorCode (*PetscExternalHelpFunction)(MPI_Comm)    = 0;

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

237:    Input Parameter:
238: +  help - the help function (may be NULL)
239: -  version - the version function (may be NULL)

241:    Level: developer

243:    Concepts: package help message

245: @*/
246: PetscErrorCode  PetscSetHelpVersionFunctions(PetscErrorCode (*help)(MPI_Comm),PetscErrorCode (*version)(MPI_Comm))
247: {
249:   PetscExternalHelpFunction    = help;
250:   PetscExternalVersionFunction = version;
251:   return(0);
252: }

254: #if defined(PETSC_HAVE_CUDA)
255: #include <cublas.h>
256: #endif

260: PetscErrorCode  PetscOptionsCheckInitial_Private(void)
261: {
262:   char           string[64],mname[PETSC_MAX_PATH_LEN],*f;
263:   MPI_Comm       comm = PETSC_COMM_WORLD;
264:   PetscBool      flg1 = PETSC_FALSE,flg2 = PETSC_FALSE,flg3 = PETSC_FALSE,flg4 = PETSC_FALSE,flag;
266:   PetscReal      si,logthreshold;
267:   int            i;
268:   PetscMPIInt    rank;
269:   char           version[256];

272:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);

274:   /*
275:       Setup the memory management; support for tracing malloc() usage
276:   */
277:   PetscOptionsHasName(NULL,"-malloc_log",&flg3);
278:   logthreshold = 0.0;
279:   PetscOptionsGetReal(NULL,"-malloc_log_threshold",&logthreshold,&flg1);
280:   if (flg1) flg3 = PETSC_TRUE;
281: #if defined(PETSC_USE_DEBUG)
282:   PetscOptionsGetBool(NULL,"-malloc",&flg1,&flg2);
283:   if ((!flg2 || flg1) && !petscsetmallocvisited) {
284:     if (flg2 || !(PETSC_RUNNING_ON_VALGRIND)) {
285:       /* turn off default -malloc if valgrind is being used */
286:       PetscSetUseTrMalloc_Private();
287:     }
288:   }
289: #else
290:   PetscOptionsGetBool(NULL,"-malloc_dump",&flg1,NULL);
291:   PetscOptionsGetBool(NULL,"-malloc",&flg2,NULL);
292:   if (flg1 || flg2 || flg3) {PetscSetUseTrMalloc_Private();}
293: #endif
294:   if (flg3) {
295:     PetscMallocSetDumpLogThreshold((PetscLogDouble)logthreshold);
296:   }
297:   flg1 = PETSC_FALSE;
298:   PetscOptionsGetBool(NULL,"-malloc_debug",&flg1,NULL);
299:   if (flg1) {
300:     PetscSetUseTrMalloc_Private();
301:     PetscMallocDebug(PETSC_TRUE);
302:   }
303:   flg1 = PETSC_FALSE;
304:   PetscOptionsGetBool(NULL,"-malloc_test",&flg1,NULL);
305: #if defined(PETSC_USE_DEBUG)
306:   if (flg1 && !PETSC_RUNNING_ON_VALGRIND) {
307:     PetscSetUseTrMalloc_Private();
308:     PetscMallocSetDumpLog();
309:     PetscMallocDebug(PETSC_TRUE);
310:   }
311: #endif

313:   flg1 = PETSC_FALSE;
314:   PetscOptionsGetBool(NULL,"-malloc_info",&flg1,NULL);
315:   if (!flg1) {
316:     flg1 = PETSC_FALSE;
317:     PetscOptionsGetBool(NULL,"-memory_info",&flg1,NULL);
318:   }
319:   if (flg1) {
320:     PetscMemorySetGetMaximumUsage();
321:   }

323:   /*
324:       Set the display variable for graphics
325:   */
326:   PetscSetDisplay();

328:   /*
329:       Print the PETSc version information
330:   */
331:   PetscOptionsHasName(NULL,"-v",&flg1);
332:   PetscOptionsHasName(NULL,"-version",&flg2);
333:   PetscOptionsHasName(NULL,"-help",&flg3);
334:   if (flg1 || flg2 || flg3) {

336:     /*
337:        Print "higher-level" package version message
338:     */
339:     if (PetscExternalVersionFunction) {
340:       (*PetscExternalVersionFunction)(comm);
341:     }

343:     PetscGetVersion(version,256);
344:     (*PetscHelpPrintf)(comm,"--------------------------------------------\
345: ------------------------------\n");
346:     (*PetscHelpPrintf)(comm,"%s\n",version);
347:     (*PetscHelpPrintf)(comm,"%s",PETSC_AUTHOR_INFO);
348:     (*PetscHelpPrintf)(comm,"See docs/changes/index.html for recent updates.\n");
349:     (*PetscHelpPrintf)(comm,"See docs/faq.html for problems.\n");
350:     (*PetscHelpPrintf)(comm,"See docs/manualpages/index.html for help. \n");
351:     (*PetscHelpPrintf)(comm,"Libraries linked from %s\n",PETSC_LIB_DIR);
352:     (*PetscHelpPrintf)(comm,"--------------------------------------------\
353: ------------------------------\n");
354:   }

356:   /*
357:        Print "higher-level" package help message
358:   */
359:   if (flg3) {
360:     if (PetscExternalHelpFunction) {
361:       (*PetscExternalHelpFunction)(comm);
362:     }
363:   }

365:   /*
366:       Setup the error handling
367:   */
368:   flg1 = PETSC_FALSE;
369:   PetscOptionsGetBool(NULL,"-on_error_abort",&flg1,NULL);
370:   if (flg1) {
371:     MPI_Comm_set_errhandler(PETSC_COMM_WORLD,MPI_ERRORS_ARE_FATAL);
372:     PetscPushErrorHandler(PetscAbortErrorHandler,0);
373:   }
374:   flg1 = PETSC_FALSE;
375:   PetscOptionsGetBool(NULL,"-on_error_mpiabort",&flg1,NULL);
376:   if (flg1) { PetscPushErrorHandler(PetscMPIAbortErrorHandler,0);}
377:   flg1 = PETSC_FALSE;
378:   PetscOptionsGetBool(NULL,"-mpi_return_on_error",&flg1,NULL);
379:   if (flg1) {
380:     MPI_Comm_set_errhandler(comm,MPI_ERRORS_RETURN);
381:   }
382:   flg1 = PETSC_FALSE;
383:   PetscOptionsGetBool(NULL,"-no_signal_handler",&flg1,NULL);
384:   if (!flg1) {PetscPushSignalHandler(PetscSignalHandlerDefault,(void*)0);}
385:   flg1 = PETSC_FALSE;
386:   PetscOptionsGetBool(NULL,"-fp_trap",&flg1,NULL);
387:   if (flg1) {PetscSetFPTrap(PETSC_FP_TRAP_ON);}

389:   /*
390:       Setup debugger information
391:   */
392:   PetscSetDefaultDebugger();
393:   PetscOptionsGetString(NULL,"-on_error_attach_debugger",string,64,&flg1);
394:   if (flg1) {
395:     MPI_Errhandler err_handler;

397:     PetscSetDebuggerFromString(string);
398:     MPI_Comm_create_errhandler((MPI_Handler_function*)Petsc_MPI_DebuggerOnError,&err_handler);
399:     MPI_Comm_set_errhandler(comm,err_handler);
400:     PetscPushErrorHandler(PetscAttachDebuggerErrorHandler,0);
401:   }
402:   PetscOptionsGetString(NULL,"-debug_terminal",string,64,&flg1);
403:   if (flg1) { PetscSetDebugTerminal(string); }
404:   PetscOptionsGetString(NULL,"-start_in_debugger",string,64,&flg1);
405:   PetscOptionsGetString(NULL,"-stop_for_debugger",string,64,&flg2);
406:   if (flg1 || flg2) {
407:     PetscMPIInt    size;
408:     PetscInt       lsize,*nodes;
409:     MPI_Errhandler err_handler;
410:     /*
411:        we have to make sure that all processors have opened
412:        connections to all other processors, otherwise once the
413:        debugger has stated it is likely to receive a SIGUSR1
414:        and kill the program.
415:     */
416:     MPI_Comm_size(PETSC_COMM_WORLD,&size);
417:     if (size > 2) {
418:       PetscMPIInt dummy = 0;
419:       MPI_Status  status;
420:       for (i=0; i<size; i++) {
421:         if (rank != i) {
422:           MPI_Send(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD);
423:         }
424:       }
425:       for (i=0; i<size; i++) {
426:         if (rank != i) {
427:           MPI_Recv(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD,&status);
428:         }
429:       }
430:     }
431:     /* check if this processor node should be in debugger */
432:     PetscMalloc(size*sizeof(PetscInt),&nodes);
433:     lsize = size;
434:     PetscOptionsGetIntArray(NULL,"-debugger_nodes",nodes,&lsize,&flag);
435:     if (flag) {
436:       for (i=0; i<lsize; i++) {
437:         if (nodes[i] == rank) { flag = PETSC_FALSE; break; }
438:       }
439:     }
440:     if (!flag) {
441:       PetscSetDebuggerFromString(string);
442:       PetscPushErrorHandler(PetscAbortErrorHandler,0);
443:       if (flg1) {
444:         PetscAttachDebugger();
445:       } else {
446:         PetscStopForDebugger();
447:       }
448:       MPI_Comm_create_errhandler((MPI_Handler_function*)Petsc_MPI_AbortOnError,&err_handler);
449:       MPI_Comm_set_errhandler(comm,err_handler);
450:     }
451:     PetscFree(nodes);
452:   }

454:   PetscOptionsGetString(NULL,"-on_error_emacs",emacsmachinename,128,&flg1);
455:   if (flg1 && !rank) {PetscPushErrorHandler(PetscEmacsClientErrorHandler,emacsmachinename);}

457:   /*
458:         Setup profiling and logging
459:   */
460: #if defined(PETSC_USE_INFO)
461:   {
462:     char logname[PETSC_MAX_PATH_LEN]; logname[0] = 0;
463:     PetscOptionsGetString(NULL,"-info",logname,250,&flg1);
464:     if (flg1 && logname[0]) {
465:       PetscInfoAllow(PETSC_TRUE,logname);
466:     } else if (flg1) {
467:       PetscInfoAllow(PETSC_TRUE,NULL);
468:     }
469:   }
470: #endif
471: #if defined(PETSC_USE_LOG)
472:   mname[0] = 0;
473:   PetscOptionsGetString(NULL,"-history",mname,PETSC_MAX_PATH_LEN,&flg1);
474:   if (flg1) {
475:     if (mname[0]) {
476:       PetscOpenHistoryFile(mname,&petsc_history);
477:     } else {
478:       PetscOpenHistoryFile(0,&petsc_history);
479:     }
480:   }
481: #if defined(PETSC_HAVE_MPE)
482:   flg1 = PETSC_FALSE;
483:   PetscOptionsHasName(NULL,"-log_mpe",&flg1);
484:   if (flg1) {PetscLogMPEBegin();}
485: #endif
486:   flg1 = PETSC_FALSE;
487:   flg2 = PETSC_FALSE;
488:   flg3 = PETSC_FALSE;
489:   PetscOptionsGetBool(NULL,"-log_all",&flg1,NULL);
490:   PetscOptionsGetBool(NULL,"-log",&flg2,NULL);
491:   PetscOptionsHasName(NULL,"-log_summary",&flg3);
492:   PetscOptionsHasName(NULL,"-log_summary_python",&flg4);
493:   if (flg1)                      { PetscLogAllBegin(); }
494:   else if (flg2 || flg3 || flg4) { PetscLogBegin();}

496:   PetscOptionsGetString(NULL,"-log_trace",mname,250,&flg1);
497:   if (flg1) {
498:     char name[PETSC_MAX_PATH_LEN],fname[PETSC_MAX_PATH_LEN];
499:     FILE *file;
500:     if (mname[0]) {
501:       sprintf(name,"%s.%d",mname,rank);
502:       PetscFixFilename(name,fname);
503:       file = fopen(fname,"w");
504:       if (!file) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to open trace file: %s",fname);
505:     } else file = PETSC_STDOUT;

507:     PetscLogTraceBegin(file);
508:   }
509: #endif

511:   PetscOptionsGetBool(NULL,"-options_gui",&PetscOptionsPublish,NULL);

513: #if defined(PETSC_HAVE_CUDA)
514:   PetscOptionsHasName(NULL,"-cuda_show_devices",&flg1);
515:   if (flg1) {
516:     struct cudaDeviceProp prop;
517:     int                   devCount;
518:     int                   device;

520:     cudaGetDeviceCount(&devCount);
521:     for (device = 0; device < devCount; ++device) {
522:       cudaGetDeviceProperties(&prop, device);
523:       PetscPrintf(PETSC_COMM_WORLD, "CUDA device %d: %s\n", device, prop.name);
524:     }
525:   }
526:   {
527:     int size;
528:     MPI_Comm_size(PETSC_COMM_WORLD,&size);
529:     if (size>1) {
530:       int devCount, device, rank;
531:       cudaGetDeviceCount(&devCount);
532:       MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
533:       device = rank % devCount;
534:       cudaSetDevice(device);
535:     } else {
536:       int device;
537:       /* the code below works for serial GPU simulations */
538:       PetscOptionsGetInt(NULL,"-cuda_set_device", &device, &flg1);
539:       if (flg1) {
540:         cudaSetDevice(device);
541:       }
542:     }
543:   }
544: #endif


547:   /*
548:        Print basic help message
549:   */
550:   PetscOptionsHasName(NULL,"-help",&flg1);
551:   if (flg1) {
552:     (*PetscHelpPrintf)(comm,"Options for all PETSc programs:\n");
553:     (*PetscHelpPrintf)(comm," -help: prints help method for each option\n");
554:     (*PetscHelpPrintf)(comm," -on_error_abort: cause an abort when an error is detected. Useful \n ");
555:     (*PetscHelpPrintf)(comm,"       only when run in the debugger\n");
556:     (*PetscHelpPrintf)(comm," -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm]\n");
557:     (*PetscHelpPrintf)(comm,"       start the debugger in new xterm\n");
558:     (*PetscHelpPrintf)(comm,"       unless noxterm is given\n");
559:     (*PetscHelpPrintf)(comm," -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm]\n");
560:     (*PetscHelpPrintf)(comm,"       start all processes in the debugger\n");
561:     (*PetscHelpPrintf)(comm," -on_error_emacs <machinename>\n");
562:     (*PetscHelpPrintf)(comm,"    emacs jumps to error file\n");
563:     (*PetscHelpPrintf)(comm," -debugger_nodes [n1,n2,..] Nodes to start in debugger\n");
564:     (*PetscHelpPrintf)(comm," -debugger_pause [m] : delay (in seconds) to attach debugger\n");
565:     (*PetscHelpPrintf)(comm," -stop_for_debugger : prints message on how to attach debugger manually\n");
566:     (*PetscHelpPrintf)(comm,"                      waits the delay for you to attach\n");
567:     (*PetscHelpPrintf)(comm," -display display: Location where graphics and debuggers are displayed\n");
568:     (*PetscHelpPrintf)(comm," -no_signal_handler: do not trap error signals\n");
569:     (*PetscHelpPrintf)(comm," -mpi_return_on_error: MPI returns error code, rather than abort on internal error\n");
570:     (*PetscHelpPrintf)(comm," -fp_trap: stop on floating point exceptions\n");
571:     (*PetscHelpPrintf)(comm,"           note on IBM RS6000 this slows run greatly\n");
572:     (*PetscHelpPrintf)(comm," -malloc_dump <optional filename>: dump list of unfreed memory at conclusion\n");
573:     (*PetscHelpPrintf)(comm," -malloc: use our error checking malloc\n");
574:     (*PetscHelpPrintf)(comm," -malloc no: don't use error checking malloc\n");
575:     (*PetscHelpPrintf)(comm," -malloc_info: prints total memory usage\n");
576:     (*PetscHelpPrintf)(comm," -malloc_log: keeps log of all memory allocations\n");
577:     (*PetscHelpPrintf)(comm," -malloc_debug: enables extended checking for memory corruption\n");
578:     (*PetscHelpPrintf)(comm," -options_table: dump list of options inputted\n");
579:     (*PetscHelpPrintf)(comm," -options_left: dump list of unused options\n");
580:     (*PetscHelpPrintf)(comm," -options_left no: don't dump list of unused options\n");
581:     (*PetscHelpPrintf)(comm," -tmp tmpdir: alternative /tmp directory\n");
582:     (*PetscHelpPrintf)(comm," -shared_tmp: tmp directory is shared by all processors\n");
583:     (*PetscHelpPrintf)(comm," -not_shared_tmp: each processor has separate tmp directory\n");
584:     (*PetscHelpPrintf)(comm," -memory_info: print memory usage at end of run\n");
585:     (*PetscHelpPrintf)(comm," -server <port>: Run PETSc webserver (default port is 8080) see PetscWebServe()\n");
586: #if defined(PETSC_USE_LOG)
587:     (*PetscHelpPrintf)(comm," -get_total_flops: total flops over all processors\n");
588:     (*PetscHelpPrintf)(comm," -log[_summary _summary_python]: logging objects and events\n");
589:     (*PetscHelpPrintf)(comm," -log_trace [filename]: prints trace of all PETSc calls\n");
590: #if defined(PETSC_HAVE_MPE)
591:     (*PetscHelpPrintf)(comm," -log_mpe: Also create logfile viewable through Jumpshot\n");
592: #endif
593:     (*PetscHelpPrintf)(comm," -info <optional filename>: print informative messages about the calculations\n");
594: #endif
595:     (*PetscHelpPrintf)(comm," -v: prints PETSc version number and release date\n");
596:     (*PetscHelpPrintf)(comm," -options_file <file>: reads options from file\n");
597:     (*PetscHelpPrintf)(comm," -petsc_sleep n: sleeps n seconds before running program\n");
598:     (*PetscHelpPrintf)(comm,"-----------------------------------------------\n");
599:   }

601: #if defined(PETSC_HAVE_SERVER)
602:   flg1 = PETSC_FALSE;
603:   PetscOptionsGetBool(NULL,"-server",&flg1,NULL);
604:   if (flg1) {
605:     PetscPOpen(PETSC_COMM_WORLD,NULL,"${PETSC_DIR}/${PETSC_ARCH}/bin/petscwebserver","r",NULL);
606:   }
607: #endif

609:   PetscOptionsGetReal(NULL,"-petsc_sleep",&si,&flg1);
610:   if (flg1) {
611:     PetscSleep(si);
612:   }

614:   PetscOptionsGetString(NULL,"-info_exclude",mname,PETSC_MAX_PATH_LEN,&flg1);
615:   PetscStrstr(mname,"null",&f);
616:   if (f) {
617:     PetscInfoDeactivateClass(0);
618:   }

620: #if defined(PETSC_HAVE_CUSP)
621:   PetscOptionsHasName(NULL,"-log_summary",&flg3);
622:   if (flg3) flg1 = PETSC_TRUE;
623:   else flg1 = PETSC_FALSE;
624:   PetscOptionsGetBool(NULL,"-cusp_synchronize",&flg1,NULL);
625:   if (flg1) PetscCUSPSynchronize = PETSC_TRUE;
626: #endif
627:   return(0);
628: }