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: MPI_Datatype MPIU_COMPLEX;
33: PetscScalar PETSC_i;
34: #else
35: PetscScalar PETSC_i = 0.0;
36: #endif
38: /*
39: These are needed by petscta.h
40: */
41: char _BT_mask,_BT_c;
42: int _BT_idx;
44: /*
45: Determines if all PETSc objects are published to the AMS
46: */
47: #if defined(PETSC_HAVE_AMS)
48: PetscTruth PetscAMSPublishAll = PETSC_FALSE;
49: #endif
51: /*
52: Function that is called to display all error messages
53: */
54: EXTERN int PetscErrorPrintfDefault(const char [],...);
55: EXTERN int PetscHelpPrintfDefault(MPI_Comm,const char [],...);
56: int (*PetscErrorPrintf)(const char [],...) = PetscErrorPrintfDefault;
57: int (*PetscHelpPrintf)(MPI_Comm,const char [],...) = PetscHelpPrintfDefault;
59: /* ------------------------------------------------------------------------------*/
60: /*
61: Optional file where all PETSc output from various prints is saved
62: */
63: FILE *petsc_history = PETSC_NULL;
65: int PetscLogOpenHistoryFile(const char filename[],FILE **fd)
66: {
67: int ierr,rank,size;
68: char pfile[256],pname[256],fname[256],date[64];
71: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
72: if (!rank) {
73: char arch[10];
74: PetscGetArchType(arch,10);
75: PetscGetDate(date,64);
76: MPI_Comm_size(PETSC_COMM_WORLD,&size);
77: if (filename) {
78: PetscFixFilename(filename,fname);
79: } else {
80: PetscGetHomeDirectory(pfile,240);
81: PetscStrcat(pfile,"/.petschistory");
82: PetscFixFilename(pfile,fname);
83: }
85: *fd = fopen(fname,"a"); if (!fd) SETERRQ1(PETSC_ERR_FILE_OPEN,"Cannot open file: %s",fname);
86: fprintf(*fd,"---------------------------------------------------------n");
87: fprintf(*fd,"%s %sn",PETSC_VERSION_NUMBER,date);
88: PetscGetProgramName(pname,256);
89: fprintf(*fd,"%s on a %s, %d proc. with options:n",pname,arch,size);
90: PetscOptionsPrint(*fd);
91: fprintf(*fd,"---------------------------------------------------------n");
92: fflush(*fd);
93: }
94: return(0);
95: }
97: int PetscLogCloseHistoryFile(FILE **fd)
98: {
99: int rank,ierr;
100: char date[64];
103: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
104: if (rank) return(0);
105: PetscGetDate(date,64);
106: fprintf(*fd,"---------------------------------------------------------n");
107: fprintf(*fd,"Finished at %sn",date);
108: fprintf(*fd,"---------------------------------------------------------n");
109: fflush(*fd);
110: fclose(*fd);
111: return(0);
112: }
114: /* ------------------------------------------------------------------------------*/
116: PetscTruth PetscCompare = PETSC_FALSE;
117: PetscReal PetscCompareTolerance = 1.e-10;
119: /*@C
120: PetscCompareInt - Compares integers while running with PETScs incremental
121: debugger.
123: Collective on PETSC_COMM_WORLD
125: Input Parameter:
126: . d - integer to compare
128: Options Database Key:
129: . -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()
131: Level: advanced
133: .seealso: PetscCompareDouble(), PetscCompareScalar()
134: @*/
135: int PetscCompareInt(int d)
136: {
137: int work = d,ierr;
140: MPI_Bcast(&work,1,MPI_INT,0,MPI_COMM_WORLD);
141: if (d != work) {
142: SETERRQ(PETSC_ERR_PLIB,"Inconsistent integer");
143: }
144: return(0);
145: }
147: /*@C
148: PetscCompareDouble - Compares doubles while running with PETScs incremental
149: debugger.
151: Collective on PETSC_COMM_WORLD
153: Input Parameter:
154: . d - double precision number to compare
156: Options Database Key:
157: . -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()
159: Level: advanced
161: .seealso: PetscCompareInt(), PetscComparseScalar()
162: @*/
163: int PetscCompareDouble(double d)
164: {
165: double work = d;
166: int ierr;
169: MPI_Bcast(&work,1,MPIU_REAL,0,MPI_COMM_WORLD);
170: if (!d && !work) return(0);
171: if (PetscAbsReal(work - d)/PetscMax(PetscAbsReal(d),PetscAbsReal(work)) > PetscCompareTolerance) {
172: SETERRQ(PETSC_ERR_PLIB,"Inconsistent double");
173: }
174: return(0);
175: }
177: /*@C
178: PetscCompareScalar - Compares scalars while running with PETScs incremental
179: debugger.
181: Collective on PETSC_COMM_WORLD
183: Input Parameter:
184: . d - scalar to compare
186: Options Database Key:
187: . -compare - Activates PetscCompareDouble(), PetscCompareInt(), and PetscCompareScalar()
189: Level: advanced
191: .seealso: PetscCompareInt(), PetscComparseDouble()
192: @*/
193: int PetscCompareScalar(PetscScalar d)
194: {
195: PetscScalar work = d;
196: int ierr;
199: MPI_Bcast(&work,2,MPIU_REAL,0,MPI_COMM_WORLD);
200: if (!PetscAbsScalar(d) && !PetscAbsScalar(work)) return(0);
201: if (PetscAbsScalar(work - d)/PetscMax(PetscAbsScalar(d),PetscAbsScalar(work)) >= PetscCompareTolerance) {
202: SETERRQ(PETSC_ERR_PLIB,"Inconsistent scalar");
203: }
204: return(0);
205: }
207: /*
208: PetscCompareInitialize - If there is a command line option -compare then
209: this routine calls MPI_Init() and sets up two PETSC_COMM_WORLD, one for
210: each program being compared.
212: Note:
213: Only works with C programs.
214: */
215: int PetscCompareInitialize(double tol)
216: {
217: int ierr,i,len,rank,*gflag,size,mysize;
218: char pname[256],basename[256];
219: MPI_Group group_all,group_sub;
220: PetscTruth work;
223: PetscGetProgramName(pname,256);
224: PetscCompareTolerance = tol;
226: MPI_Comm_rank(MPI_COMM_WORLD,&rank);
227: MPI_Comm_size(MPI_COMM_WORLD,&size);
228: if (!rank) {
229: PetscStrcpy(basename,pname);
230: PetscStrlen(basename,&len);
231: }
233: /* broadcase name from first processor to all processors */
234: MPI_Bcast(&len,1,MPI_INT,0,MPI_COMM_WORLD);
235: MPI_Bcast(basename,len+1,MPI_CHAR,0,MPI_COMM_WORLD);
237: /* determine what processors belong to my group */
238: PetscStrcmp(pname,basename,&work);
240: gflag = (int*)malloc(size*sizeof(int));
241: MPI_Allgather(&work,1,MPI_INT,gflag,1,MPI_INT,MPI_COMM_WORLD);
242: mysize = 0;
243: for (i=0; i<size; i++) {
244: if (work == gflag[i]) gflag[mysize++] = i;
245: }
246: /* printf("[%d] my name %s basename %s mysize %dn",rank,programname,basename,mysize); */
248: if (!mysize || mysize == size) {
249: SETERRQ(PETSC_ERR_ARG_IDN,"Need two different programs to compare");
250: }
252: /* create a new communicator for each program */
253: MPI_Comm_group(MPI_COMM_WORLD,&group_all);
254: MPI_Group_incl(group_all,mysize,gflag,&group_sub);
255: MPI_Comm_create(MPI_COMM_WORLD,group_sub,&PETSC_COMM_WORLD);
256: MPI_Group_free(&group_all);
257: MPI_Group_free(&group_sub);
258: free(gflag);
260: PetscCompare = PETSC_TRUE;
261: PetscLogInfo(0,"PetscCompareInitialize:Configured to compare two programsn");
262: return(0);
263: }
264: /* ------------------------------------------------------------------------------------*/
266:
267: /*
268: This is ugly and probably belongs somewhere else, but I want to
269: be able to put a true MPI abort error handler with command line args.
271: This is so MPI errors in the debugger will leave all the stack
272: frames. The default abort cleans up and exits.
273: */
275: void Petsc_MPI_AbortOnError(MPI_Comm *comm,int *flag)
276: {
278: (*PetscErrorPrintf)("MPI error %dn",*flag);
279: abort();
280: }
282: void Petsc_MPI_DebuggerOnError(MPI_Comm *comm,int *flag)
283: {
287: (*PetscErrorPrintf)("MPI error %dn",*flag);
288: PetscAttachDebugger();
289: if (ierr) { /* hopeless so get out */
290: MPI_Finalize();
291: exit(*flag);
292: }
293: }
295: /*@C
296: PetscEnd - Calls PetscFinalize() and then ends the program. This is useful if one
297: wishes a clean exit somewhere deep in the program.
299: Collective on PETSC_COMM_WORLD
301: Options Database Keys are the same as for PetscFinalize()
303: Level: advanced
305: Note:
306: See PetscInitialize() for more general runtime options.
308: .seealso: PetscInitialize(), PetscOptionsPrint(), PetscTrDump(), PetscMPIDump(), PetscFinalize()
309: @*/
310: int PetscEnd(void)
311: {
313: PetscFinalize();
314: exit(0);
315: return 0;
316: }
318: PetscTruth PetscOptionsPublish = PETSC_FALSE;
319: EXTERN int PetscLogInfoAllow(PetscTruth,char *);
320: EXTERN int PetscSetUseTrMalloc_Private(void);
321: extern PetscTruth petscsetmallocvisited;
322: static char emacsmachinename[128];
324: int (*PetscExternalVersionFunction)(MPI_Comm) = 0;
325: int (*PetscExternalHelpFunction)(MPI_Comm) = 0;
327: /*@C
328: PetscSetHelpVersionFunctions - Sets functions that print help and version information
329: before the PETSc help and version information is printed. Must call BEFORE PetscInitialize().
330: This routine enables a "higher-level" package that uses PETSc to print its messages first.
332: Input Parameter:
333: + help - the help function (may be PETSC_NULL)
334: - version - the version function (may be PETSc null)
336: Level: developer
338: Concepts: package help message
340: @*/
341: int PetscSetHelpVersionFunctions(int (*help)(MPI_Comm),int (*version)(MPI_Comm))
342: {
344: PetscExternalHelpFunction = help;
345: PetscExternalVersionFunction = version;
346: return(0);
347: }
349: int PetscOptionsCheckInitial(void)
350: {
351: char string[64],mname[256],*f;
352: MPI_Comm comm = PETSC_COMM_WORLD;
353: PetscTruth flg1,flg2,flg3,flag;
354: int ierr,*nodes,i,rank;
357: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
359: #if defined(PETSC_HAVE_AMS)
360: PetscOptionsHasName(PETSC_NULL,"-ams_publish_options",&flg3);
361: if (flg3) PetscOptionsPublish = PETSC_TRUE;
362: #endif
364: /*
365: Setup the memory management; support for tracing malloc() usage
366: */
367: PetscOptionsHasName(PETSC_NULL,"-trmalloc_log",&flg3);
368: #if defined(PETSC_USE_BOPT_g)
369: /* always does trmalloc with BOPT=g, just check so does not reported never checked */
370: PetscOptionsHasName(PETSC_NULL,"-trmalloc",&flg1);
371: PetscOptionsHasName(PETSC_NULL,"-trmalloc_off",&flg1);
372: if (!flg1 && !petscsetmallocvisited) {
373: PetscSetUseTrMalloc_Private();
374: }
375: #else
376: PetscOptionsHasName(PETSC_NULL,"-trdump",&flg1);
377: PetscOptionsHasName(PETSC_NULL,"-trmalloc",&flg2);
378: if (flg1 || flg2 || flg3) {PetscSetUseTrMalloc_Private();}
379: #endif
380: if (flg3) {
381: PetscTrLog();
382: }
383: PetscOptionsHasName(PETSC_NULL,"-trdebug",&flg1);
384: if (flg1) {
385: PetscTrDebugLevel(1);
386: }
388: /*
389: Set the display variable for graphics
390: */
391: PetscSetDisplay();
393: /*
394: Print the PETSc version information
395: */
396: PetscOptionsHasName(PETSC_NULL,"-v",&flg1);
397: PetscOptionsHasName(PETSC_NULL,"-version",&flg2);
398: PetscOptionsHasName(PETSC_NULL,"-help",&flg3);
399: if (flg1 || flg2 || flg3){
401: /*
402: Print "higher-level" package version message
403: */
404: if (PetscExternalVersionFunction) {
405: (*PetscExternalVersionFunction)(comm);
406: }
408: (*PetscHelpPrintf)(comm,"--------------------------------------------
409: ------------------------------n");
410: (*PetscHelpPrintf)(comm,"t %sn",PETSC_VERSION_NUMBER);
411: (*PetscHelpPrintf)(comm,"%s",PETSC_AUTHOR_INFO);
412: (*PetscHelpPrintf)(comm,"See docs/copyright.html for copyright informationn");
413: (*PetscHelpPrintf)(comm,"See docs/changes/index.html for recent updates.n");
414: (*PetscHelpPrintf)(comm,"See docs/troubleshooting.html for problems.n");
415: (*PetscHelpPrintf)(comm,"See docs/manualpages/index.html for help. n");
416: #if !defined(PARCH_win32)
417: (*PetscHelpPrintf)(comm,"Libraries linked from %sn",PETSC_LIB_DIR);
418: #endif
419: (*PetscHelpPrintf)(comm,"--------------------------------------------
420: ------------------------------n");
421: }
423: /*
424: Print "higher-level" package help message
425: */
426: if (flg3){
427: if (PetscExternalHelpFunction) {
428: (*PetscExternalHelpFunction)(comm);
429: }
430: }
432: /*
433: Setup the error handling
434: */
435: PetscOptionsHasName(PETSC_NULL,"-fp_trap",&flg1);
436: if (flg1) { PetscSetFPTrap(PETSC_FP_TRAP_ON); }
437: PetscOptionsHasName(PETSC_NULL,"-on_error_abort",&flg1);
438: if (flg1) { PetscPushErrorHandler(PetscAbortErrorHandler,0);CHKERRQ(ierr)}
439: PetscOptionsHasName(PETSC_NULL,"-on_error_stop",&flg1);
440: if (flg1) { PetscPushErrorHandler(PetscStopErrorHandler,0);CHKERRQ(ierr)}
441: PetscOptionsHasName(PETSC_NULL,"-mpi_return_on_error",&flg1);
442: if (flg1) {
443: MPI_Errhandler_set(comm,MPI_ERRORS_RETURN);
444: }
445: PetscOptionsHasName(PETSC_NULL,"-no_signal_handler",&flg1);
446: if (!flg1) { PetscPushSignalHandler(PetscDefaultSignalHandler,(void*)0);CHKERRQ(ierr) }
448: /*
449: Setup debugger information
450: */
451: PetscSetDefaultDebugger();
452: PetscOptionsGetString(PETSC_NULL,"-on_error_attach_debugger",string,64,&flg1);
453: if (flg1) {
454: MPI_Errhandler err_handler;
456: PetscSetDebuggerFromString(string);
457: MPI_Errhandler_create((MPI_Handler_function*)Petsc_MPI_DebuggerOnError,&err_handler);
458: MPI_Errhandler_set(comm,err_handler);
459: PetscPushErrorHandler(PetscAttachDebuggerErrorHandler,0);
460: }
461: PetscOptionsGetString(PETSC_NULL,"-start_in_debugger",string,64,&flg1);
462: PetscOptionsGetString(PETSC_NULL,"-stop_for_debugger",string,64,&flg2);
463: if (flg1 || flg2) {
464: int size;
465: MPI_Errhandler err_handler;
466: /*
467: we have to make sure that all processors have opened
468: connections to all other processors, otherwise once the
469: debugger has stated it is likely to receive a SIGUSR1
470: and kill the program.
471: */
472: MPI_Comm_size(PETSC_COMM_WORLD,&size);
473: if (size > 2) {
474: int dummy;
475: MPI_Status status;
476: for (i=0; i<size; i++) {
477: MPI_Send(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD);
478: }
479: for (i=0; i<size; i++) {
480: MPI_Recv(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD,&status);
481: }
482: }
483: /* check if this processor node should be in debugger */
484: PetscMalloc(size*sizeof(int),&nodes);
485: PetscOptionsGetIntArray(PETSC_NULL,"-debugger_nodes",nodes,&size,&flag);
486: if (flag) {
487: for (i=0; i<size; i++) {
488: if (nodes[i] == rank) { flag = PETSC_FALSE; break; }
489: }
490: }
491: if (!flag) {
492: PetscSetDebuggerFromString(string);
493: PetscPushErrorHandler(PetscAbortErrorHandler,0);
494: if (flg1) {
495: PetscAttachDebugger();
496: } else {
497: PetscStopForDebugger();
498: }
499: MPI_Errhandler_create((MPI_Handler_function*)Petsc_MPI_AbortOnError,&err_handler);
500: MPI_Errhandler_set(comm,err_handler);
501: }
502: PetscFree(nodes);
503: }
505: PetscOptionsGetString(PETSC_NULL,"-on_error_emacs",emacsmachinename,128,&flg1);
506: if (flg1 && !rank) {PetscPushErrorHandler(PetscEmacsClientErrorHandler,emacsmachinename);CHKERRQ(ierr)}
508: /*
509: Setup profiling and logging
510: */
511: #if defined(PETSC_USE_LOG)
512: mname[0] = 0;
513: PetscOptionsGetString(PETSC_NULL,"-log_history",mname,256,&flg1);
514: if (flg1) {
515: if (mname[0]) {
516: PetscLogOpenHistoryFile(mname,&petsc_history);
517: } else {
518: PetscLogOpenHistoryFile(0,&petsc_history);
519: }
520: }
521: PetscOptionsHasName(PETSC_NULL,"-log_info",&flg1);
522: if (flg1) {
523: char logname[256]; logname[0] = 0;
524: PetscOptionsGetString(PETSC_NULL,"-log_info",logname,250,&flg1);
525: if (logname[0]) {
526: PetscLogInfoAllow(PETSC_TRUE,logname);
527: } else {
528: PetscLogInfoAllow(PETSC_TRUE,PETSC_NULL);
529: }
530: }
531: #if defined(PETSC_HAVE_MPE)
532: PetscOptionsHasName(PETSC_NULL,"-log_mpe",&flg1);
533: if (flg1) PetscLogMPEBegin();
534: #endif
535: PetscOptionsHasName(PETSC_NULL,"-log_all",&flg1);
536: PetscOptionsHasName(PETSC_NULL,"-log",&flg2);
537: PetscOptionsHasName(PETSC_NULL,"-log_summary",&flg3);
538: if (flg1) { PetscLogAllBegin(); }
539: else if (flg2 || flg3) { PetscLogBegin();}
540:
541: PetscOptionsGetString(PETSC_NULL,"-log_trace",mname,250,&flg1);
542: if (flg1) {
543: char name[256],fname[256];
544: FILE *file;
545: if (mname[0]) {
546: sprintf(name,"%s.%d",mname,rank);
547: PetscFixFilename(name,fname);
548: file = fopen(fname,"w");
549: if (!file) {
550: SETERRQ1(PETSC_ERR_FILE_OPEN,"Unable to open trace file: %s",fname);
551: }
552: } else {
553: file = stdout;
554: }
555: PetscLogTraceBegin(file);
556: }
557: #endif
559: /*
560: Setup building of stack frames for all function calls
561: */
562: #if defined(PETSC_USE_STACK)
563: #if defined(PETSC_USE_BOPT_g)
564: PetscStackCreate();
565: #else
566: PetscOptionsHasName(PETSC_NULL,"-log_stack",&flg1);
567: if (flg1) {
568: PetscStackCreate();
569: }
570: #endif
571: #endif
574: /*
575: Print basic help message
576: */
577: PetscOptionsHasName(PETSC_NULL,"-help",&flg1);
578: if (flg1) {
579: (*PetscHelpPrintf)(comm,"Options for all PETSc programs:n");
580: (*PetscHelpPrintf)(comm," -on_error_abort: cause an abort when an error is");
581: (*PetscHelpPrintf)(comm," detected. Useful n only when run in the debuggern");
582: (*PetscHelpPrintf)(comm," -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm]n");
583: (*PetscHelpPrintf)(comm," start the debugger in new xtermn");
584: (*PetscHelpPrintf)(comm," unless noxterm is givenn");
585: (*PetscHelpPrintf)(comm," -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm]n");
586: (*PetscHelpPrintf)(comm," start all processes in the debuggern");
587: (*PetscHelpPrintf)(comm," -on_error_emacs <machinename>n");
588: (*PetscHelpPrintf)(comm," emacs jumps to error filen");
589: (*PetscHelpPrintf)(comm," -debugger_nodes [n1,n2,..] Nodes to start in debuggern");
590: (*PetscHelpPrintf)(comm," -debugger_pause [m] : delay (in seconds) to attach debuggern");
591: (*PetscHelpPrintf)(comm," -stop_for_debugger : prints message on how to attach debugger manuallyn");
592: (*PetscHelpPrintf)(comm," waits the delay for you to attachn");
593: (*PetscHelpPrintf)(comm," -display display: Location where graphics and debuggers are displayedn");
594: (*PetscHelpPrintf)(comm," -no_signal_handler: do not trap error signalsn");
595: (*PetscHelpPrintf)(comm," -mpi_return_on_error: MPI returns error code, rather than abort on internal errorn");
596: (*PetscHelpPrintf)(comm," -fp_trap: stop on floating point exceptionsn");
597: (*PetscHelpPrintf)(comm," note on IBM RS6000 this slows run greatlyn");
598: (*PetscHelpPrintf)(comm," -trdump <optional filename>: dump list of unfreed memory at conclusionn");
599: (*PetscHelpPrintf)(comm," -trmalloc: use our error checking mallocn");
600: (*PetscHelpPrintf)(comm," -trmalloc_off: don't use error checking mallocn");
601: (*PetscHelpPrintf)(comm," -trinfo: prints total memory usagen");
602: (*PetscHelpPrintf)(comm," -trdebug: enables extended checking for memory corruptionn");
603: (*PetscHelpPrintf)(comm," -options_table: dump list of options inputtedn");
604: (*PetscHelpPrintf)(comm," -options_left: dump list of unused optionsn");
605: (*PetscHelpPrintf)(comm," -options_left no: don't dump list of unused optionsn");
606: (*PetscHelpPrintf)(comm," -tmp tmpdir: alternative /tmp directoryn");
607: (*PetscHelpPrintf)(comm," -shared_tmp: tmp directory is shared by all processorsn");
608: (*PetscHelpPrintf)(comm," -not_shared_tmp: each processor has seperate tmp directoryn");
609: (*PetscHelpPrintf)(comm," -get_resident_set_size: print memory usage at end of runn");
610: #if defined(PETSC_USE_LOG)
611: (*PetscHelpPrintf)(comm," -get_total_flops: total flops over all processorsn");
612: (*PetscHelpPrintf)(comm," -log[_all _summary]: logging objects and eventsn");
613: (*PetscHelpPrintf)(comm," -log_trace [filename]: prints trace of all PETSc callsn");
614: #if defined(PETSC_HAVE_MPE)
615: (*PetscHelpPrintf)(comm," -log_mpe: Also create logfile viewable through upshotn");
616: #endif
617: (*PetscHelpPrintf)(comm," -log_info <optional filename>: print informative messages about the calculationsn");
618: #endif
619: (*PetscHelpPrintf)(comm," -v: prints PETSc version number and release daten");
620: (*PetscHelpPrintf)(comm," -options_file <file>: reads options from filen");
621: (*PetscHelpPrintf)(comm," -petsc_sleep n: sleeps n seconds before running programn");
622: #if defined(PETSC_HAVE_AMS)
623: (*PetscHelpPrintf)(comm," -ams_publish_objects: n");
624: (*PetscHelpPrintf)(comm," -ams_publish_stack: n");
625: #endif
626: (*PetscHelpPrintf)(comm,"-----------------------------------------------n");
627: }
629: /*
630: Setup advanced compare feature for allowing comparison to two running PETSc programs
631: */
632: PetscOptionsHasName(PETSC_NULL,"-compare",&flg1);
633: if (flg1) {
634: PetscReal tol = 1.e-12;
635: PetscOptionsGetReal(PETSC_NULL,"-compare",&tol,&flg1);
636: PetscCompareInitialize(tol);
637: }
638: PetscOptionsGetInt(PETSC_NULL,"-petsc_sleep",&i,&flg1);
639: if (flg1) {
640: PetscSleep(i);
641: }
643: PetscOptionsGetString(PETSC_NULL,"-log_info_exclude",mname,256,&flg1);
644: PetscStrstr(mname,"null",&f);
645: if (f) {
646: PetscLogInfoDeactivateClass(PETSC_NULL);
647: }
649: return(0);
650: }