Actual source code: init.c
1: /*
3: This file defines part of the initialization of PETSc
5: This file uses regular malloc and free because it cannot be known
6: what malloc is being used until it has already processed the input.
7: */
8: #include <petsc/private/petscimpl.h>
10: #if defined(PETSC_HAVE_SYS_SYSINFO_H)
11: #include <sys/sysinfo.h>
12: #endif
13: #if defined(PETSC_HAVE_UNISTD_H)
14: #include <unistd.h>
15: #endif
17: /* ------------------------Nasty global variables -------------------------------*/
18: /*
19: Indicates if PETSc started up MPI, or it was
20: already started before PETSc was initialized.
21: */
22: PetscBool PetscBeganMPI = PETSC_FALSE;
23: PetscBool PetscErrorHandlingInitialized = PETSC_FALSE;
24: PetscBool PetscInitializeCalled = PETSC_FALSE;
25: PetscBool PetscFinalizeCalled = PETSC_FALSE;
27: PetscMPIInt PetscGlobalRank = -1;
28: PetscMPIInt PetscGlobalSize = -1;
30: #if defined(PETSC_HAVE_KOKKOS)
31: PetscBool PetscBeganKokkos = PETSC_FALSE;
32: #endif
34: #if defined(PETSC_HAVE_NVSHMEM)
35: PetscBool PetscBeganNvshmem = PETSC_FALSE;
36: PetscBool PetscNvshmemInitialized = PETSC_FALSE;
37: #endif
39: PetscBool use_gpu_aware_mpi = PetscDefined(HAVE_MPIUNI) ? PETSC_FALSE : PETSC_TRUE;
41: #if defined(PETSC_HAVE_COMPLEX)
42: #if defined(PETSC_COMPLEX_INSTANTIATE)
43: template <> class std::complex<double>; /* instantiate complex template class */
44: #endif
46: /*MC
47: PETSC_i - the imaginary number i
49: Synopsis:
50: #include <petscsys.h>
51: PetscComplex PETSC_i;
53: Level: beginner
55: Note:
56: Complex numbers are automatically available if PETSc located a working complex implementation
58: .seealso: PetscRealPart(), PetscImaginaryPart(), PetscRealPartComplex(), PetscImaginaryPartComplex()
59: M*/
60: PetscComplex PETSC_i;
61: MPI_Datatype MPIU___COMPLEX128 = 0;
62: #endif /* PETSC_HAVE_COMPLEX */
63: #if defined(PETSC_USE_REAL___FLOAT128)
64: MPI_Datatype MPIU___FLOAT128 = 0;
65: #elif defined(PETSC_USE_REAL___FP16)
66: MPI_Datatype MPIU___FP16 = 0;
67: #endif
68: MPI_Datatype MPIU_2SCALAR = 0;
69: MPI_Datatype MPIU_REAL_INT = 0;
70: MPI_Datatype MPIU_SCALAR_INT = 0;
71: #if defined(PETSC_USE_64BIT_INDICES)
72: MPI_Datatype MPIU_2INT = 0;
73: #endif
74: MPI_Datatype MPI_4INT = 0;
75: MPI_Datatype MPIU_4INT = 0;
76: MPI_Datatype MPIU_BOOL;
77: MPI_Datatype MPIU_ENUM;
78: MPI_Datatype MPIU_FORTRANADDR;
79: MPI_Datatype MPIU_SIZE_T;
81: /*
82: Function that is called to display all error messages
83: */
84: PetscErrorCode (*PetscErrorPrintf)(const char [],...) = PetscErrorPrintfDefault;
85: PetscErrorCode (*PetscHelpPrintf)(MPI_Comm,const char [],...) = PetscHelpPrintfDefault;
86: PetscErrorCode (*PetscVFPrintf)(FILE*,const char[],va_list) = PetscVFPrintfDefault;
88: /* ------------------------------------------------------------------------------*/
89: /*
90: Optional file where all PETSc output from various prints is saved
91: */
92: PETSC_INTERN FILE *petsc_history;
93: FILE *petsc_history = NULL;
95: PetscErrorCode PetscOpenHistoryFile(const char filename[],FILE **fd)
96: {
97: PetscMPIInt rank,size;
98: char pfile[PETSC_MAX_PATH_LEN],pname[PETSC_MAX_PATH_LEN],fname[PETSC_MAX_PATH_LEN],date[64];
99: char version[256];
101: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
102: if (rank == 0) {
103: char arch[10];
104: int err;
106: PetscGetArchType(arch,10);
107: PetscGetDate(date,64);
108: PetscGetVersion(version,256);
109: MPI_Comm_size(PETSC_COMM_WORLD,&size);
110: if (filename) {
111: PetscFixFilename(filename,fname);
112: } else {
113: PetscGetHomeDirectory(pfile,sizeof(pfile));
114: PetscStrlcat(pfile,"/.petschistory",sizeof(pfile));
115: PetscFixFilename(pfile,fname);
116: }
118: *fd = fopen(fname,"a");
121: PetscFPrintf(PETSC_COMM_SELF,*fd,"----------------------------------------\n");
122: PetscFPrintf(PETSC_COMM_SELF,*fd,"%s %s\n",version,date);
123: PetscGetProgramName(pname,sizeof(pname));
124: PetscFPrintf(PETSC_COMM_SELF,*fd,"%s on a %s, %d proc. with options:\n",pname,arch,size);
125: PetscFPrintf(PETSC_COMM_SELF,*fd,"----------------------------------------\n");
127: err = fflush(*fd);
129: }
130: return 0;
131: }
133: PETSC_INTERN PetscErrorCode PetscCloseHistoryFile(FILE **fd)
134: {
135: PetscMPIInt rank;
136: char date[64];
137: int err;
139: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
140: if (rank == 0) {
141: PetscGetDate(date,64);
142: PetscFPrintf(PETSC_COMM_SELF,*fd,"----------------------------------------\n");
143: PetscFPrintf(PETSC_COMM_SELF,*fd,"Finished at %s\n",date);
144: PetscFPrintf(PETSC_COMM_SELF,*fd,"----------------------------------------\n");
145: err = fflush(*fd);
147: err = fclose(*fd);
149: }
150: return 0;
151: }
153: /* ------------------------------------------------------------------------------*/
155: /*
156: This is ugly and probably belongs somewhere else, but I want to
157: be able to put a true MPI abort error handler with command line args.
159: This is so MPI errors in the debugger will leave all the stack
160: frames. The default MP_Abort() cleans up and exits thus providing no useful information
161: in the debugger hence we call abort() instead of MPI_Abort().
162: */
164: void Petsc_MPI_AbortOnError(MPI_Comm *comm,PetscMPIInt *flag,...)
165: {
166: (*PetscErrorPrintf)("MPI error %d\n",*flag);
167: abort();
168: }
170: void Petsc_MPI_DebuggerOnError(MPI_Comm *comm,PetscMPIInt *flag,...)
171: {
172: (*PetscErrorPrintf)("MPI error %d\n",*flag);
173: if (PetscAttachDebugger()) PETSCABORT(*comm,*flag); /* hopeless so get out */
174: }
176: /*@C
177: PetscEnd - Calls PetscFinalize() and then ends the program. This is useful if one
178: wishes a clean exit somewhere deep in the program.
180: Collective on PETSC_COMM_WORLD
182: Options Database Keys are the same as for PetscFinalize()
184: Level: advanced
186: Note:
187: See PetscInitialize() for more general runtime options.
189: .seealso: PetscInitialize(), PetscOptionsView(), PetscMallocDump(), PetscMPIDump(), PetscFinalize()
190: @*/
191: PetscErrorCode PetscEnd(void)
192: {
193: PetscFinalize();
194: exit(0);
195: return 0;
196: }
198: PetscBool PetscOptionsPublish = PETSC_FALSE;
199: PETSC_INTERN PetscErrorCode PetscSetUseHBWMalloc_Private(void);
200: PETSC_INTERN PetscBool petscsetmallocvisited;
201: static char emacsmachinename[256];
203: PetscErrorCode (*PetscExternalVersionFunction)(MPI_Comm) = NULL;
204: PetscErrorCode (*PetscExternalHelpFunction)(MPI_Comm) = NULL;
206: #if PetscDefined(USE_LOG)
207: #include <petscviewer.h>
208: #endif
210: /*@C
211: PetscSetHelpVersionFunctions - Sets functions that print help and version information
212: before the PETSc help and version information is printed. Must call BEFORE PetscInitialize().
213: This routine enables a "higher-level" package that uses PETSc to print its messages first.
215: Input Parameters:
216: + help - the help function (may be NULL)
217: - version - the version function (may be NULL)
219: Level: developer
221: @*/
222: PetscErrorCode PetscSetHelpVersionFunctions(PetscErrorCode (*help)(MPI_Comm),PetscErrorCode (*version)(MPI_Comm))
223: {
224: PetscExternalHelpFunction = help;
225: PetscExternalVersionFunction = version;
226: return 0;
227: }
229: #if defined(PETSC_USE_LOG)
230: PETSC_INTERN PetscBool PetscObjectsLog;
231: #endif
233: PETSC_INTERN PetscErrorCode PetscOptionsCheckInitial_Private(const char help[])
234: {
235: char string[64];
236: MPI_Comm comm = PETSC_COMM_WORLD;
237: PetscBool flg1 = PETSC_FALSE,flg2 = PETSC_FALSE,flg3 = PETSC_FALSE,flag,hasHelp;
238: PetscReal si;
239: PetscInt intensity;
240: int i;
241: PetscMPIInt rank;
242: char version[256];
243: #if defined(PETSC_USE_LOG)
244: char mname[PETSC_MAX_PATH_LEN];
245: PetscViewerFormat format;
246: PetscBool flg4 = PETSC_FALSE;
247: #endif
249: MPI_Comm_rank(comm,&rank);
251: /*
252: Setup building of stack frames for all function calls
253: */
254: if (PetscDefined(USE_DEBUG) && !PetscDefined(HAVE_THREADSAFETY)) {
255: PetscOptionsGetBool(NULL,NULL,"-checkstack",&flg1,NULL);
256: PetscStackSetCheck(flg1);
257: }
259: #if !defined(PETSC_HAVE_THREADSAFETY)
260: if (!(PETSC_RUNNING_ON_VALGRIND)) {
261: /*
262: Setup the memory management; support for tracing malloc() usage
263: */
264: PetscBool mdebug = PETSC_FALSE, eachcall = PETSC_FALSE, initializenan = PETSC_FALSE, mlog = PETSC_FALSE;
266: if (PetscDefined(USE_DEBUG)) {
267: mdebug = PETSC_TRUE;
268: initializenan = PETSC_TRUE;
269: PetscOptionsHasName(NULL,NULL,"-malloc_test",&flg1);
270: } else {
271: /* don't warn about unused option */
272: PetscOptionsHasName(NULL,NULL,"-malloc_test",&flg1);
273: flg1 = PETSC_FALSE;
274: }
275: PetscOptionsGetBool(NULL,NULL,"-malloc_debug",&flg2,&flg3);
276: if (flg1 || flg2) {
277: mdebug = PETSC_TRUE;
278: eachcall = PETSC_TRUE;
279: initializenan = PETSC_TRUE;
280: } else if (flg3 && !flg2) {
281: mdebug = PETSC_FALSE;
282: eachcall = PETSC_FALSE;
283: initializenan = PETSC_FALSE;
284: }
286: PetscOptionsGetBool(NULL,NULL,"-malloc_requested_size",&flg1,&flg2);
287: if (flg2) PetscMallocLogRequestedSizeSet(flg1);
289: PetscOptionsHasName(NULL,NULL,"-malloc_view",&mlog);
290: if (mlog) {
291: mdebug = PETSC_TRUE;
292: }
293: /* the next line is deprecated */
294: PetscOptionsGetBool(NULL,NULL,"-malloc",&mdebug,NULL);
295: PetscOptionsGetBool(NULL,NULL,"-malloc_dump",&mdebug,NULL);
296: PetscOptionsGetBool(NULL,NULL,"-log_view_memory",&mdebug,NULL);
297: if (mdebug) {
298: PetscMallocSetDebug(eachcall,initializenan);
299: }
300: if (mlog) {
301: PetscReal logthreshold = 0;
302: PetscOptionsGetReal(NULL,NULL,"-malloc_view_threshold",&logthreshold,NULL);
303: PetscMallocViewSet(logthreshold);
304: }
305: #if defined(PETSC_USE_LOG)
306: PetscOptionsGetBool(NULL,NULL,"-log_view_memory",&PetscLogMemory,NULL);
307: #endif
308: }
310: PetscOptionsGetBool(NULL,NULL,"-malloc_coalesce",&flg1,&flg2);
311: if (flg2) PetscMallocSetCoalesce(flg1);
312: flg1 = PETSC_FALSE;
313: PetscOptionsGetBool(NULL,NULL,"-malloc_hbw",&flg1,NULL);
314: /* ignore this option if malloc is already set */
315: if (flg1 && !petscsetmallocvisited) PetscSetUseHBWMalloc_Private();
317: flg1 = PETSC_FALSE;
318: PetscOptionsGetBool(NULL,NULL,"-malloc_info",&flg1,NULL);
319: if (!flg1) {
320: flg1 = PETSC_FALSE;
321: PetscOptionsGetBool(NULL,NULL,"-memory_view",&flg1,NULL);
322: }
323: if (flg1) {
324: PetscMemorySetGetMaximumUsage();
325: }
326: #endif
328: #if defined(PETSC_USE_LOG)
329: PetscOptionsHasName(NULL,NULL,"-objects_dump",&PetscObjectsLog);
330: #endif
332: /*
333: Set the display variable for graphics
334: */
335: PetscSetDisplay();
337: /*
338: Print main application help message
339: */
340: PetscOptionsHasHelp(NULL,&hasHelp);
341: if (help && hasHelp) {
342: PetscPrintf(comm,"%s",help);
343: PetscPrintf(comm,"----------------------------------------\n");
344: }
346: /*
347: Print the PETSc version information
348: */
349: PetscOptionsHasName(NULL,NULL,"-version",&flg1);
350: if (flg1 || hasHelp) {
351: /*
352: Print "higher-level" package version message
353: */
354: if (PetscExternalVersionFunction) {
355: (*PetscExternalVersionFunction)(comm);
356: }
358: PetscGetVersion(version,256);
359: (*PetscHelpPrintf)(comm,"%s\n",version);
360: (*PetscHelpPrintf)(comm,"%s",PETSC_AUTHOR_INFO);
361: (*PetscHelpPrintf)(comm,"See docs/changes/index.html for recent updates.\n");
362: (*PetscHelpPrintf)(comm,"See docs/faq.html for problems.\n");
363: (*PetscHelpPrintf)(comm,"See docs/manualpages/index.html for help. \n");
364: (*PetscHelpPrintf)(comm,"Libraries linked from %s\n",PETSC_LIB_DIR);
365: (*PetscHelpPrintf)(comm,"----------------------------------------\n");
366: }
368: /*
369: Print "higher-level" package help message
370: */
371: if (hasHelp) {
372: PetscBool hasHelpIntro;
374: if (PetscExternalHelpFunction) {
375: (*PetscExternalHelpFunction)(comm);
376: }
377: PetscOptionsHasHelpIntro_Internal(NULL,&hasHelpIntro);
378: if (hasHelpIntro) {
379: PetscOptionsDestroyDefault();
380: PetscFreeMPIResources();
381: MPI_Finalize();
382: exit(0);
383: }
384: }
386: /*
387: Setup the error handling
388: */
389: flg1 = PETSC_FALSE;
390: PetscOptionsGetBool(NULL,NULL,"-on_error_abort",&flg1,NULL);
391: if (flg1) {
392: MPI_Comm_set_errhandler(comm,MPI_ERRORS_ARE_FATAL);
393: PetscPushErrorHandler(PetscAbortErrorHandler,NULL);
394: }
395: flg1 = PETSC_FALSE;
396: PetscOptionsGetBool(NULL,NULL,"-on_error_mpiabort",&flg1,NULL);
397: if (flg1) PetscPushErrorHandler(PetscMPIAbortErrorHandler,NULL);
398: flg1 = PETSC_FALSE;
399: PetscOptionsGetBool(NULL,NULL,"-mpi_return_on_error",&flg1,NULL);
400: if (flg1) {
401: MPI_Comm_set_errhandler(comm,MPI_ERRORS_RETURN);
402: }
403: flg1 = PETSC_FALSE;
404: PetscOptionsGetBool(NULL,NULL,"-no_signal_handler",&flg1,NULL);
405: if (!flg1) PetscPushSignalHandler(PetscSignalHandlerDefault,(void*)0);
407: /*
408: Setup debugger information
409: */
410: PetscSetDefaultDebugger();
411: PetscOptionsGetString(NULL,NULL,"-on_error_attach_debugger",string,sizeof(string),&flg1);
412: if (flg1) {
413: MPI_Errhandler err_handler;
415: PetscSetDebuggerFromString(string);
416: MPI_Comm_create_errhandler(Petsc_MPI_DebuggerOnError,&err_handler);
417: MPI_Comm_set_errhandler(comm,err_handler);
418: PetscPushErrorHandler(PetscAttachDebuggerErrorHandler,NULL);
419: }
420: PetscOptionsGetString(NULL,NULL,"-debug_terminal",string,sizeof(string),&flg1);
421: if (flg1) PetscSetDebugTerminal(string);
422: PetscOptionsGetString(NULL,NULL,"-start_in_debugger",string,sizeof(string),&flg1);
423: PetscOptionsGetString(NULL,NULL,"-stop_for_debugger",string,sizeof(string),&flg2);
424: if (flg1 || flg2) {
425: PetscMPIInt size;
426: PetscInt lsize,*ranks;
427: MPI_Errhandler err_handler;
428: /*
429: we have to make sure that all processors have opened
430: connections to all other processors, otherwise once the
431: debugger has stated it is likely to receive a SIGUSR1
432: and kill the program.
433: */
434: MPI_Comm_size(comm,&size);
435: if (size > 2) {
436: PetscMPIInt dummy = 0;
437: MPI_Status status;
438: for (i=0; i<size; i++) {
439: if (rank != i) {
440: MPI_Send(&dummy,1,MPI_INT,i,109,comm);
441: }
442: }
443: for (i=0; i<size; i++) {
444: if (rank != i) {
445: MPI_Recv(&dummy,1,MPI_INT,i,109,comm,&status);
446: }
447: }
448: }
449: /* check if this processor node should be in debugger */
450: PetscMalloc1(size,&ranks);
451: lsize = size;
452: /* Deprecated in 3.14 */
453: PetscOptionsGetIntArray(NULL,NULL,"-debugger_nodes",ranks,&lsize,&flag);
454: if (flag) {
455: const char * const quietopt="-options_suppress_deprecated_warnings";
456: char msg[4096];
457: PetscBool quiet = PETSC_FALSE;
459: PetscOptionsGetBool(NULL,NULL,quietopt,&quiet,NULL);
460: if (!quiet) {
461: PetscStrcpy(msg,"** PETSc DEPRECATION WARNING ** : the option ");
462: PetscStrcat(msg,"-debugger_nodes");
463: PetscStrcat(msg," is deprecated as of version ");
464: PetscStrcat(msg,"3.14");
465: PetscStrcat(msg," and will be removed in a future release.");
466: PetscStrcat(msg," Please use the option ");
467: PetscStrcat(msg,"-debugger_ranks");
468: PetscStrcat(msg," instead.");
469: PetscStrcat(msg," (Silence this warning with ");
470: PetscStrcat(msg,quietopt);
471: PetscStrcat(msg,")\n");
472: PetscPrintf(comm,"%s",msg);
473: }
474: } else {
475: lsize = size;
476: PetscOptionsGetIntArray(NULL,NULL,"-debugger_ranks",ranks,&lsize,&flag);
477: }
478: if (flag) {
479: for (i=0; i<lsize; i++) {
480: if (ranks[i] == rank) { flag = PETSC_FALSE; break; }
481: }
482: }
483: if (!flag) {
484: PetscSetDebuggerFromString(string);
485: PetscPushErrorHandler(PetscAbortErrorHandler,NULL);
486: if (flg1) {
487: PetscAttachDebugger();
488: } else {
489: PetscStopForDebugger();
490: }
491: MPI_Comm_create_errhandler(Petsc_MPI_AbortOnError,&err_handler);
492: MPI_Comm_set_errhandler(comm,err_handler);
493: } else {
494: PetscWaitOnError();
495: }
496: PetscFree(ranks);
497: }
499: PetscOptionsGetString(NULL,NULL,"-on_error_emacs",emacsmachinename,sizeof(emacsmachinename),&flg1);
500: if (flg1 && rank == 0) PetscPushErrorHandler(PetscEmacsClientErrorHandler,emacsmachinename);
502: /*
503: Setup profiling and logging
504: */
505: #if defined(PETSC_USE_INFO)
506: {
507: PetscInfoSetFromOptions(NULL);
508: }
509: #endif
510: PetscDetermineInitialFPTrap();
511: flg1 = PETSC_FALSE;
512: PetscOptionsGetBool(NULL,NULL,"-fp_trap",&flg1,&flag);
513: if (flag) PetscSetFPTrap((PetscFPTrap)flg1);
514: PetscOptionsGetInt(NULL,NULL,"-check_pointer_intensity",&intensity,&flag);
516: #if defined(PETSC_USE_LOG)
517: mname[0] = 0;
518: PetscOptionsGetString(NULL,NULL,"-history",mname,sizeof(mname),&flg1);
519: if (flg1) {
520: if (mname[0]) {
521: PetscOpenHistoryFile(mname,&petsc_history);
522: } else {
523: PetscOpenHistoryFile(NULL,&petsc_history);
524: }
525: }
527: PetscOptionsGetBool(NULL,NULL,"-log_sync",&PetscLogSyncOn,NULL);
529: #if defined(PETSC_HAVE_MPE)
530: flg1 = PETSC_FALSE;
531: PetscOptionsHasName(NULL,NULL,"-log_mpe",&flg1);
532: if (flg1) PetscLogMPEBegin();
533: #endif
534: flg1 = PETSC_FALSE;
535: flg3 = PETSC_FALSE;
536: PetscOptionsGetBool(NULL,NULL,"-log_all",&flg1,NULL);
537: PetscOptionsHasName(NULL,NULL,"-log_summary",&flg3);
538: if (flg1) PetscLogAllBegin();
539: else if (flg3) PetscLogDefaultBegin();
541: PetscOptionsGetString(NULL,NULL,"-log_trace",mname,sizeof(mname),&flg1);
542: if (flg1) {
543: char name[PETSC_MAX_PATH_LEN],fname[PETSC_MAX_PATH_LEN];
544: FILE *file;
545: if (mname[0]) {
546: PetscSNPrintf(name,PETSC_MAX_PATH_LEN,"%s.%d",mname,rank);
547: PetscFixFilename(name,fname);
548: file = fopen(fname,"w");
550: } else file = PETSC_STDOUT;
551: PetscLogTraceBegin(file);
552: }
554: PetscOptionsGetViewer(comm,NULL,NULL,"-log_view",NULL,&format,&flg4);
555: if (flg4) {
556: if (format == PETSC_VIEWER_ASCII_XML || format == PETSC_VIEWER_ASCII_FLAMEGRAPH) {
557: PetscLogNestedBegin();
558: } else {
559: PetscLogDefaultBegin();
560: }
561: }
562: if (flg4 && (format == PETSC_VIEWER_ASCII_XML || format == PETSC_VIEWER_ASCII_FLAMEGRAPH)) {
563: PetscReal threshold = PetscRealConstant(0.01);
564: PetscOptionsGetReal(NULL,NULL,"-log_threshold",&threshold,&flg1);
565: if (flg1) PetscLogSetThreshold((PetscLogDouble)threshold,NULL);
566: }
567: #endif
569: PetscOptionsGetBool(NULL,NULL,"-saws_options",&PetscOptionsPublish,NULL);
570: PetscOptionsGetBool(NULL,NULL,"-use_gpu_aware_mpi",&use_gpu_aware_mpi,NULL);
572: /*
573: Print basic help message
574: */
575: if (hasHelp) {
576: (*PetscHelpPrintf)(comm,"Options for all PETSc programs:\n");
577: (*PetscHelpPrintf)(comm," -version: prints PETSc version\n");
578: (*PetscHelpPrintf)(comm," -help intro: prints example description and PETSc version, and exits\n");
579: (*PetscHelpPrintf)(comm," -help: prints example description, PETSc version, and available options for used routines\n");
580: (*PetscHelpPrintf)(comm," -on_error_abort: cause an abort when an error is detected. Useful \n ");
581: (*PetscHelpPrintf)(comm," only when run in the debugger\n");
582: (*PetscHelpPrintf)(comm," -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm]\n");
583: (*PetscHelpPrintf)(comm," start the debugger in new xterm\n");
584: (*PetscHelpPrintf)(comm," unless noxterm is given\n");
585: (*PetscHelpPrintf)(comm," -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm]\n");
586: (*PetscHelpPrintf)(comm," start all processes in the debugger\n");
587: (*PetscHelpPrintf)(comm," -on_error_emacs <machinename>\n");
588: (*PetscHelpPrintf)(comm," emacs jumps to error file\n");
589: (*PetscHelpPrintf)(comm," -debugger_ranks [n1,n2,..] Ranks to start in debugger\n");
590: (*PetscHelpPrintf)(comm," -debugger_pause [m] : delay (in seconds) to attach debugger\n");
591: (*PetscHelpPrintf)(comm," -stop_for_debugger : prints message on how to attach debugger manually\n");
592: (*PetscHelpPrintf)(comm," waits the delay for you to attach\n");
593: (*PetscHelpPrintf)(comm," -display display: Location where X window graphics and debuggers are displayed\n");
594: (*PetscHelpPrintf)(comm," -no_signal_handler: do not trap error signals\n");
595: (*PetscHelpPrintf)(comm," -mpi_return_on_error: MPI returns error code, rather than abort on internal error\n");
596: (*PetscHelpPrintf)(comm," -fp_trap: stop on floating point exceptions\n");
597: (*PetscHelpPrintf)(comm," note on IBM RS6000 this slows run greatly\n");
598: (*PetscHelpPrintf)(comm," -malloc_dump <optional filename>: dump list of unfreed memory at conclusion\n");
599: (*PetscHelpPrintf)(comm," -malloc: use PETSc error checking malloc (deprecated, use -malloc_debug)\n");
600: (*PetscHelpPrintf)(comm," -malloc no: don't use PETSc error checking malloc (deprecated, use -malloc_debug no)\n");
601: (*PetscHelpPrintf)(comm," -malloc_info: prints total memory usage\n");
602: (*PetscHelpPrintf)(comm," -malloc_view <optional filename>: keeps log of all memory allocations, displays in PetscFinalize()\n");
603: (*PetscHelpPrintf)(comm," -malloc_debug <true or false>: enables or disables extended checking for memory corruption\n");
604: (*PetscHelpPrintf)(comm," -options_view: dump list of options inputted\n");
605: (*PetscHelpPrintf)(comm," -options_left: dump list of unused options\n");
606: (*PetscHelpPrintf)(comm," -options_left no: don't dump list of unused options\n");
607: (*PetscHelpPrintf)(comm," -tmp tmpdir: alternative /tmp directory\n");
608: (*PetscHelpPrintf)(comm," -shared_tmp: tmp directory is shared by all processors\n");
609: (*PetscHelpPrintf)(comm," -not_shared_tmp: each processor has separate tmp directory\n");
610: (*PetscHelpPrintf)(comm," -memory_view: print memory usage at end of run\n");
611: #if defined(PETSC_USE_LOG)
612: (*PetscHelpPrintf)(comm," -get_total_flops: total flops over all processors\n");
613: (*PetscHelpPrintf)(comm," -log_view [:filename:[format]]: logging objects and events\n");
614: (*PetscHelpPrintf)(comm," -log_trace [filename]: prints trace of all PETSc calls\n");
615: (*PetscHelpPrintf)(comm," -log_exclude <list,of,classnames>: exclude given classes from logging\n");
616: #if defined(PETSC_HAVE_MPE)
617: (*PetscHelpPrintf)(comm," -log_mpe: Also create logfile viewable through Jumpshot\n");
618: #endif
619: #endif
620: #if defined(PETSC_USE_INFO)
621: (*PetscHelpPrintf)(comm," -info [filename][:[~]<list,of,classnames>[:[~]self]]: print verbose information\n");
622: #endif
623: (*PetscHelpPrintf)(comm," -options_file <file>: reads options from file\n");
624: (*PetscHelpPrintf)(comm," -options_monitor: monitor options to standard output, including that set previously e.g. in option files\n");
625: (*PetscHelpPrintf)(comm," -options_monitor_cancel: cancels all hardwired option monitors\n");
626: (*PetscHelpPrintf)(comm," -petsc_sleep n: sleeps n seconds before running program\n");
627: }
629: #if defined(PETSC_HAVE_POPEN)
630: {
631: char machine[128];
632: PetscOptionsGetString(NULL,NULL,"-popen_machine",machine,sizeof(machine),&flg1);
633: if (flg1) {
634: PetscPOpenSetMachine(machine);
635: }
636: }
637: #endif
639: PetscOptionsGetReal(NULL,NULL,"-petsc_sleep",&si,&flg1);
640: if (flg1) {
641: PetscSleep(si);
642: }
643: return 0;
644: }