Actual source code: init.c
1: /*$Id: init.c,v 1.72 2001/04/05 21:06:49 balay Exp bsmith $*/
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: Scalar PETSC_i;
34: #else
35: Scalar 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,MPI_DOUBLE,0,MPI_COMM_WORLD);
170: if (!d && !work) return(0);
171: if (PetscAbsDouble(work - d)/PetscMax(PetscAbsDouble(d),PetscAbsDouble(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(Scalar d)
194: {
195: Scalar work = d;
196: int ierr;
199: MPI_Bcast(&work,2,MPI_DOUBLE,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",rank);
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: PetscTruth PetscOptionsPublish = PETSC_FALSE;
296: EXTERN int PetscLogInfoAllow(PetscTruth,char *);
297: EXTERN int PetscSetUseTrMalloc_Private(void);
298: extern PetscTruth petscsetmallocvisited;
299: static char emacsmachinename[128];
301: int (*PetscExternalVersionFunction)(MPI_Comm) = 0;
302: int (*PetscExternalHelpFunction)(MPI_Comm) = 0;
304: /*@C
305: PetscSetHelpVersionFunctions - Sets functions that print help and version information
306: before the PETSc help and version information is printed. Must call BEFORE PetscInitialize().
307: This routine enables a "higher-level" package that uses PETSc to print its messages first.
309: Input Parameter:
310: + help - the help function (may be PETSC_NULL)
311: - version - the version function (may be PETSc null)
313: Level: developer
315: Concepts: package help message
317: @*/
318: int PetscSetHelpVersionFunctions(int (*help)(MPI_Comm),int (*version)(MPI_Comm))
319: {
321: PetscExternalHelpFunction = help;
322: PetscExternalVersionFunction = version;
323: return(0);
324: }
326: int PetscOptionsCheckInitial(void)
327: {
328: char string[64],mname[256],*f;
329: MPI_Comm comm = PETSC_COMM_WORLD;
330: PetscTruth flg1,flg2,flg3,flag;
331: int ierr,*nodes,i,rank;
334: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
336: #if defined(PETSC_HAVE_AMS)
337: PetscOptionsHasName(PETSC_NULL,"-ams_publish_options",&flg3);
338: if (flg3) PetscOptionsPublish = PETSC_TRUE;
339: #endif
341: /*
342: Setup the memory management; support for tracing malloc() usage
343: */
344: PetscOptionsHasName(PETSC_NULL,"-trmalloc_log",&flg3);
345: #if defined(PETSC_USE_BOPT_g)
346: /* always does trmalloc with BOPT=g, just check so does not reported never checked */
347: PetscOptionsHasName(PETSC_NULL,"-trmalloc",&flg1);
348: PetscOptionsHasName(PETSC_NULL,"-trmalloc_off",&flg1);
349: if (!flg1 && !petscsetmallocvisited) {
350: PetscSetUseTrMalloc_Private();
351: }
352: #else
353: PetscOptionsHasName(PETSC_NULL,"-trdump",&flg1);
354: PetscOptionsHasName(PETSC_NULL,"-trmalloc",&flg2);
355: if (flg1 || flg2 || flg3) {PetscSetUseTrMalloc_Private();}
356: #endif
357: if (flg3) {
358: PetscTrLog();
359: }
360: PetscOptionsHasName(PETSC_NULL,"-trdebug",&flg1);
361: if (flg1) {
362: PetscTrDebugLevel(1);
363: }
365: /*
366: Set the display variable for graphics
367: */
368: PetscSetDisplay();
370: /*
371: Print the PETSc version information
372: */
373: PetscOptionsHasName(PETSC_NULL,"-v",&flg1);
374: PetscOptionsHasName(PETSC_NULL,"-version",&flg2);
375: PetscOptionsHasName(PETSC_NULL,"-help",&flg3);
376: if (flg1 || flg2 || flg3){
378: /*
379: Print "higher-level" package version message
380: */
381: if (PetscExternalVersionFunction) {
382: (*PetscExternalVersionFunction)(comm);
383: }
385: (*PetscHelpPrintf)(comm,"--------------------------------------------
386: ------------------------------n");
387: (*PetscHelpPrintf)(comm,"t %sn",PETSC_VERSION_NUMBER);
388: (*PetscHelpPrintf)(comm,"%s",PETSC_AUTHOR_INFO);
389: (*PetscHelpPrintf)(comm,"See docs/copyright.html for copyright informationn");
390: (*PetscHelpPrintf)(comm,"See docs/changes/index.html for recent updates.n");
391: (*PetscHelpPrintf)(comm,"See docs/troubleshooting.html for problems.n");
392: (*PetscHelpPrintf)(comm,"See docs/manualpages/index.html for help. n");
393: #if !defined(PARCH_win32)
394: (*PetscHelpPrintf)(comm,"Libraries linked from %sn",PETSC_LIB_DIR);
395: #endif
396: (*PetscHelpPrintf)(comm,"--------------------------------------------
397: ------------------------------n");
398: }
400: /*
401: Print "higher-level" package help message
402: */
403: if (flg3){
404: if (PetscExternalHelpFunction) {
405: (*PetscExternalHelpFunction)(comm);
406: }
407: }
409: /*
410: Setup the error handling
411: */
412: PetscOptionsHasName(PETSC_NULL,"-fp_trap",&flg1);
413: if (flg1) { PetscSetFPTrap(PETSC_FP_TRAP_ON); }
414: PetscOptionsHasName(PETSC_NULL,"-on_error_abort",&flg1);
415: if (flg1) { PetscPushErrorHandler(PetscAbortErrorHandler,0);CHKERRQ(ierr)}
416: PetscOptionsHasName(PETSC_NULL,"-on_error_stop",&flg1);
417: if (flg1) { PetscPushErrorHandler(PetscStopErrorHandler,0);CHKERRQ(ierr)}
418: PetscOptionsHasName(PETSC_NULL,"-mpi_return_on_error",&flg1);
419: if (flg1) {
420: MPI_Errhandler_set(comm,MPI_ERRORS_RETURN);
421: }
422: PetscOptionsHasName(PETSC_NULL,"-no_signal_handler",&flg1);
423: if (!flg1) { PetscPushSignalHandler(PetscDefaultSignalHandler,(void*)0);CHKERRQ(ierr) }
425: /*
426: Setup debugger information
427: */
428: PetscSetDefaultDebugger();
429: PetscOptionsGetString(PETSC_NULL,"-on_error_attach_debugger",string,64,&flg1);
430: if (flg1) {
431: MPI_Errhandler err_handler;
433: PetscSetDebuggerFromString(string);
434: MPI_Errhandler_create((MPI_Handler_function*)Petsc_MPI_DebuggerOnError,&err_handler);
435: MPI_Errhandler_set(comm,err_handler);
436: PetscPushErrorHandler(PetscAttachDebuggerErrorHandler,0);
437: }
438: PetscOptionsGetString(PETSC_NULL,"-start_in_debugger",string,64,&flg1);
439: PetscOptionsGetString(PETSC_NULL,"-stop_for_debugger",string,64,&flg2);
440: if (flg1 || flg2) {
441: int size;
442: MPI_Errhandler err_handler;
443: /*
444: we have to make sure that all processors have opened
445: connections to all other processors, otherwise once the
446: debugger has stated it is likely to receive a SIGUSR1
447: and kill the program.
448: */
449: MPI_Comm_size(PETSC_COMM_WORLD,&size);
450: if (size > 2) {
451: int dummy;
452: MPI_Status status;
453: for (i=0; i<size; i++) {
454: MPI_Send(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD);
455: }
456: for (i=0; i<size; i++) {
457: MPI_Recv(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD,&status);
458: }
459: }
460: /* check if this processor node should be in debugger */
461: PetscMalloc(size*sizeof(int),&nodes);
462: PetscOptionsGetIntArray(PETSC_NULL,"-debugger_nodes",nodes,&size,&flag);
463: if (flag) {
464: for (i=0; i<size; i++) {
465: if (nodes[i] == rank) { flag = PETSC_FALSE; break; }
466: }
467: }
468: if (!flag) {
469: PetscSetDebuggerFromString(string);
470: PetscPushErrorHandler(PetscAbortErrorHandler,0);
471: if (flg1) {
472: PetscAttachDebugger();
473: } else {
474: PetscStopForDebugger();
475: }
476: MPI_Errhandler_create((MPI_Handler_function*)Petsc_MPI_AbortOnError,&err_handler);
477: MPI_Errhandler_set(comm,err_handler);
478: }
479: PetscFree(nodes);
480: }
482: PetscOptionsGetString(PETSC_NULL,"-on_error_emacs",emacsmachinename,128,&flg1);
483: if (flg1 && !rank) {PetscPushErrorHandler(PetscEmacsClientErrorHandler,emacsmachinename);CHKERRQ(ierr)}
485: /*
486: Setup profiling and logging
487: */
488: #if defined(PETSC_USE_LOG)
489: mname[0] = 0;
490: PetscOptionsGetString(PETSC_NULL,"-log_history",mname,256,&flg1);
491: if (flg1) {
492: if (mname[0]) {
493: PetscLogOpenHistoryFile(mname,&petsc_history);
494: } else {
495: PetscLogOpenHistoryFile(0,&petsc_history);
496: }
497: }
498: PetscOptionsHasName(PETSC_NULL,"-log_info",&flg1);
499: if (flg1) {
500: char logname[256]; logname[0] = 0;
501: PetscOptionsGetString(PETSC_NULL,"-log_info",logname,250,&flg1);
502: if (logname[0]) {
503: PetscLogInfoAllow(PETSC_TRUE,logname);
504: } else {
505: PetscLogInfoAllow(PETSC_TRUE,PETSC_NULL);
506: }
507: }
508: #if defined(PETSC_HAVE_MPE)
509: PetscOptionsHasName(PETSC_NULL,"-log_mpe",&flg1);
510: if (flg1) PetscLogMPEBegin();
511: #endif
512: PetscOptionsHasName(PETSC_NULL,"-log_all",&flg1);
513: PetscOptionsHasName(PETSC_NULL,"-log",&flg2);
514: PetscOptionsHasName(PETSC_NULL,"-log_summary",&flg3);
515: if (flg1) { PetscLogAllBegin(); }
516: else if (flg2 || flg3) { PetscLogBegin();}
517:
518: PetscOptionsGetString(PETSC_NULL,"-log_trace",mname,250,&flg1);
519: if (flg1) {
520: char name[256],fname[256];
521: FILE *file;
522: if (mname[0]) {
523: sprintf(name,"%s.%d",mname,rank);
524: PetscFixFilename(name,fname);
525: file = fopen(fname,"w");
526: if (!file) {
527: SETERRQ1(PETSC_ERR_FILE_OPEN,"Unable to open trace file: %s",fname);
528: }
529: } else {
530: file = stdout;
531: }
532: PetscLogTraceBegin(file);
533: }
534: #endif
536: /*
537: Setup building of stack frames for all function calls
538: */
539: #if defined(PETSC_USE_STACK)
540: #if defined(PETSC_USE_BOPT_g)
541: PetscStackCreate();
542: #else
543: PetscOptionsHasName(PETSC_NULL,"-log_stack",&flg1);
544: if (flg1) {
545: PetscStackCreate();
546: }
547: #endif
548: #endif
551: /*
552: Print basic help message
553: */
554: PetscOptionsHasName(PETSC_NULL,"-help",&flg1);
555: if (flg1) {
556: (*PetscHelpPrintf)(comm,"Options for all PETSc programs:n");
557: (*PetscHelpPrintf)(comm," -on_error_abort: cause an abort when an error is");
558: (*PetscHelpPrintf)(comm," detected. Useful n only when run in the debuggern");
559: (*PetscHelpPrintf)(comm," -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm]n");
560: (*PetscHelpPrintf)(comm," start the debugger in new xtermn");
561: (*PetscHelpPrintf)(comm," unless noxterm is givenn");
562: (*PetscHelpPrintf)(comm," -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm]n");
563: (*PetscHelpPrintf)(comm," start all processes in the debuggern");
564: (*PetscHelpPrintf)(comm," -on_error_emacs <machinename>n");
565: (*PetscHelpPrintf)(comm," emacs jumps to error filen");
566: (*PetscHelpPrintf)(comm," -debugger_nodes [n1,n2,..] Nodes to start in debuggern");
567: (*PetscHelpPrintf)(comm," -debugger_pause [m] : delay (in seconds) to attach debuggern");
568: (*PetscHelpPrintf)(comm," -stop_for_debugger : prints message on how to attach debugger manuallyn");
569: (*PetscHelpPrintf)(comm," waits the delay for you to attachn");
570: (*PetscHelpPrintf)(comm," -display display: Location where graphics and debuggers are displayedn");
571: (*PetscHelpPrintf)(comm," -no_signal_handler: do not trap error signalsn");
572: (*PetscHelpPrintf)(comm," -mpi_return_on_error: MPI returns error code, rather than abort on internal errorn");
573: (*PetscHelpPrintf)(comm," -fp_trap: stop on floating point exceptionsn");
574: (*PetscHelpPrintf)(comm," note on IBM RS6000 this slows run greatlyn");
575: (*PetscHelpPrintf)(comm," -trdump <optional filename>: dump list of unfreed memory at conclusionn");
576: (*PetscHelpPrintf)(comm," -trmalloc: use our error checking mallocn");
577: (*PetscHelpPrintf)(comm," -trmalloc_off: don't use error checking mallocn");
578: (*PetscHelpPrintf)(comm," -trinfo: prints total memory usagen");
579: (*PetscHelpPrintf)(comm," -trdebug: enables extended checking for memory corruptionn");
580: (*PetscHelpPrintf)(comm," -options_table: dump list of options inputtedn");
581: (*PetscHelpPrintf)(comm," -options_left: dump list of unused optionsn");
582: (*PetscHelpPrintf)(comm," -options_left no: don't dump list of unused optionsn");
583: (*PetscHelpPrintf)(comm," -tmp tmpdir: alternative /tmp directoryn");
584: (*PetscHelpPrintf)(comm," -shared_tmp: tmp directory is shared by all processorsn");
585: (*PetscHelpPrintf)(comm," -not_shared_tmp: each processor has seperate tmp directoryn");
586: (*PetscHelpPrintf)(comm," -get_resident_set_size: print memory usage at end of runn");
587: #if defined(PETSC_USE_LOG)
588: (*PetscHelpPrintf)(comm," -get_total_flops: total flops over all processorsn");
589: (*PetscHelpPrintf)(comm," -log[_all _summary]: logging objects and eventsn");
590: (*PetscHelpPrintf)(comm," -log_trace [filename]: prints trace of all PETSc callsn");
591: #if defined(PETSC_HAVE_MPE)
592: (*PetscHelpPrintf)(comm," -log_mpe: Also create logfile viewable through upshotn");
593: #endif
594: (*PetscHelpPrintf)(comm," -log_info <optional filename>: print informative messages about the calculationsn");
595: #endif
596: (*PetscHelpPrintf)(comm," -v: prints PETSc version number and release daten");
597: (*PetscHelpPrintf)(comm," -options_file <file>: reads options from filen");
598: (*PetscHelpPrintf)(comm," -petsc_sleep n: sleeps n seconds before running programn");
599: #if defined(PETSC_HAVE_AMS)
600: (*PetscHelpPrintf)(comm," -ams_publish_objects: n");
601: (*PetscHelpPrintf)(comm," -ams_publish_stack: n");
602: #endif
603: (*PetscHelpPrintf)(comm,"-----------------------------------------------n");
604: }
606: /*
607: Setup advanced compare feature for allowing comparison to two running PETSc programs
608: */
609: PetscOptionsHasName(PETSC_NULL,"-compare",&flg1);
610: if (flg1) {
611: double tol = 1.e-12;
612: PetscOptionsGetDouble(PETSC_NULL,"-compare",&tol,&flg1);
613: PetscCompareInitialize(tol);
614: }
615: PetscOptionsGetInt(PETSC_NULL,"-petsc_sleep",&i,&flg1);
616: if (flg1) {
617: PetscSleep(i);
618: }
620: PetscOptionsGetString(PETSC_NULL,"-log_info_exclude",mname,256,&flg1);
621: PetscStrstr(mname,"null",&f);
622: if (f) {
623: PetscLogInfoDeactivateClass(PETSC_NULL);
624: }
626: return(0);
627: }