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