Actual source code: init.c
petsc-3.5.4 2015-05-23
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 GPU synchronization
86: */
87: PetscBool PetscCUSPSynchronize = PETSC_FALSE;
88: PetscBool PetscViennaCLSynchronize = PETSC_FALSE;
90: /* ------------------------------------------------------------------------------*/
91: /*
92: Optional file where all PETSc output from various prints is saved
93: */
94: FILE *petsc_history = NULL;
98: PetscErrorCode PetscOpenHistoryFile(const char filename[],FILE **fd)
99: {
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];
106: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
107: if (!rank) {
108: char arch[10];
109: int err;
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: PetscFPrintf(PETSC_COMM_SELF,*fd,"---------------------------------------------------------\n");
132: err = fflush(*fd);
133: if (err) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SYS,"fflush() failed on file");
134: }
135: return(0);
136: }
140: PetscErrorCode PetscCloseHistoryFile(FILE **fd)
141: {
143: PetscMPIInt rank;
144: char date[64];
145: int err;
148: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
149: if (!rank) {
150: PetscGetDate(date,64);
151: PetscFPrintf(PETSC_COMM_SELF,*fd,"---------------------------------------------------------\n");
152: PetscFPrintf(PETSC_COMM_SELF,*fd,"Finished at %s\n",date);
153: PetscFPrintf(PETSC_COMM_SELF,*fd,"---------------------------------------------------------\n");
154: err = fflush(*fd);
155: if (err) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SYS,"fflush() failed on file");
156: err = fclose(*fd);
157: if (err) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SYS,"fclose() failed on file");
158: }
159: return(0);
160: }
162: /* ------------------------------------------------------------------------------*/
164: /*
165: This is ugly and probably belongs somewhere else, but I want to
166: be able to put a true MPI abort error handler with command line args.
168: This is so MPI errors in the debugger will leave all the stack
169: frames. The default MP_Abort() cleans up and exits thus providing no useful information
170: in the debugger hence we call abort() instead of MPI_Abort().
171: */
175: void Petsc_MPI_AbortOnError(MPI_Comm *comm,PetscMPIInt *flag)
176: {
178: (*PetscErrorPrintf)("MPI error %d\n",*flag);
179: abort();
180: }
184: void Petsc_MPI_DebuggerOnError(MPI_Comm *comm,PetscMPIInt *flag)
185: {
189: (*PetscErrorPrintf)("MPI error %d\n",*flag);
190: PetscAttachDebugger();
191: if (ierr) MPI_Abort(*comm,*flag); /* hopeless so get out */
192: }
196: /*@C
197: PetscEnd - Calls PetscFinalize() and then ends the program. This is useful if one
198: wishes a clean exit somewhere deep in the program.
200: Collective on PETSC_COMM_WORLD
202: Options Database Keys are the same as for PetscFinalize()
204: Level: advanced
206: Note:
207: See PetscInitialize() for more general runtime options.
209: .seealso: PetscInitialize(), PetscOptionsView(), PetscMallocDump(), PetscMPIDump(), PetscFinalize()
210: @*/
211: PetscErrorCode PetscEnd(void)
212: {
214: PetscFinalize();
215: exit(0);
216: return 0;
217: }
219: PetscBool PetscOptionsPublish = PETSC_FALSE;
220: extern PetscErrorCode PetscSetUseTrMalloc_Private(void);
221: extern PetscBool petscsetmallocvisited;
222: static char emacsmachinename[256];
224: PetscErrorCode (*PetscExternalVersionFunction)(MPI_Comm) = 0;
225: PetscErrorCode (*PetscExternalHelpFunction)(MPI_Comm) = 0;
229: /*@C
230: PetscSetHelpVersionFunctions - Sets functions that print help and version information
231: before the PETSc help and version information is printed. Must call BEFORE PetscInitialize().
232: This routine enables a "higher-level" package that uses PETSc to print its messages first.
234: Input Parameter:
235: + help - the help function (may be NULL)
236: - version - the version function (may be NULL)
238: Level: developer
240: Concepts: package help message
242: @*/
243: PetscErrorCode PetscSetHelpVersionFunctions(PetscErrorCode (*help)(MPI_Comm),PetscErrorCode (*version)(MPI_Comm))
244: {
246: PetscExternalHelpFunction = help;
247: PetscExternalVersionFunction = version;
248: return(0);
249: }
251: #if defined(PETSC_HAVE_CUDA)
252: #include <cublas.h>
253: #endif
255: #if defined(PETSC_USE_LOG)
256: extern PetscBool PetscObjectsLog;
257: #endif
261: PetscErrorCode PetscOptionsCheckInitial_Private(void)
262: {
263: char string[64],mname[PETSC_MAX_PATH_LEN],*f;
264: MPI_Comm comm = PETSC_COMM_WORLD;
265: PetscBool flg1 = PETSC_FALSE,flg2 = PETSC_FALSE,flg3 = PETSC_FALSE,flg4 = PETSC_FALSE,flag;
267: PetscReal si,logthreshold;
268: PetscInt intensity;
269: int i;
270: PetscMPIInt rank;
271: char version[256];
274: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
276: /*
277: Setup the memory management; support for tracing malloc() usage
278: */
279: PetscOptionsHasName(NULL,"-malloc_log",&flg3);
280: logthreshold = 0.0;
281: PetscOptionsGetReal(NULL,"-malloc_log_threshold",&logthreshold,&flg1);
282: if (flg1) flg3 = PETSC_TRUE;
283: #if defined(PETSC_USE_DEBUG)
284: PetscOptionsGetBool(NULL,"-malloc",&flg1,&flg2);
285: if ((!flg2 || flg1) && !petscsetmallocvisited) {
286: if (flg2 || !(PETSC_RUNNING_ON_VALGRIND)) {
287: /* turn off default -malloc if valgrind is being used */
288: PetscSetUseTrMalloc_Private();
289: }
290: }
291: #else
292: PetscOptionsGetBool(NULL,"-malloc_dump",&flg1,NULL);
293: PetscOptionsGetBool(NULL,"-malloc",&flg2,NULL);
294: if (flg1 || flg2 || flg3) {PetscSetUseTrMalloc_Private();}
295: #endif
296: if (flg3) {
297: PetscMallocSetDumpLogThreshold((PetscLogDouble)logthreshold);
298: }
299: flg1 = PETSC_FALSE;
300: PetscOptionsGetBool(NULL,"-malloc_debug",&flg1,NULL);
301: if (flg1) {
302: PetscSetUseTrMalloc_Private();
303: PetscMallocDebug(PETSC_TRUE);
304: }
305: flg1 = PETSC_FALSE;
306: PetscOptionsGetBool(NULL,"-malloc_test",&flg1,NULL);
307: #if defined(PETSC_USE_DEBUG)
308: if (flg1 && !PETSC_RUNNING_ON_VALGRIND) {
309: PetscSetUseTrMalloc_Private();
310: PetscMallocSetDumpLog();
311: PetscMallocDebug(PETSC_TRUE);
312: }
313: #endif
315: flg1 = PETSC_FALSE;
316: PetscOptionsGetBool(NULL,"-malloc_info",&flg1,NULL);
317: if (!flg1) {
318: flg1 = PETSC_FALSE;
319: PetscOptionsGetBool(NULL,"-memory_info",&flg1,NULL);
320: }
321: if (flg1) {
322: PetscMemorySetGetMaximumUsage();
323: }
325: #if defined(PETSC_USE_LOG)
326: PetscOptionsHasName(NULL,"-objects_dump",&PetscObjectsLog);
327: #endif
329: /*
330: Set the display variable for graphics
331: */
332: PetscSetDisplay();
334: /*
335: Print the PETSc version information
336: */
337: PetscOptionsHasName(NULL,"-v",&flg1);
338: PetscOptionsHasName(NULL,"-version",&flg2);
339: PetscOptionsHasName(NULL,"-help",&flg3);
340: if (flg1 || flg2 || flg3) {
342: /*
343: Print "higher-level" package version message
344: */
345: if (PetscExternalVersionFunction) {
346: (*PetscExternalVersionFunction)(comm);
347: }
349: PetscGetVersion(version,256);
350: (*PetscHelpPrintf)(comm,"--------------------------------------------\
351: ------------------------------\n");
352: (*PetscHelpPrintf)(comm,"%s\n",version);
353: (*PetscHelpPrintf)(comm,"%s",PETSC_AUTHOR_INFO);
354: (*PetscHelpPrintf)(comm,"See docs/changes/index.html for recent updates.\n");
355: (*PetscHelpPrintf)(comm,"See docs/faq.html for problems.\n");
356: (*PetscHelpPrintf)(comm,"See docs/manualpages/index.html for help. \n");
357: (*PetscHelpPrintf)(comm,"Libraries linked from %s\n",PETSC_LIB_DIR);
358: (*PetscHelpPrintf)(comm,"--------------------------------------------\
359: ------------------------------\n");
360: }
362: /*
363: Print "higher-level" package help message
364: */
365: if (flg3) {
366: if (PetscExternalHelpFunction) {
367: (*PetscExternalHelpFunction)(comm);
368: }
369: }
371: /*
372: Setup the error handling
373: */
374: flg1 = PETSC_FALSE;
375: PetscOptionsGetBool(NULL,"-on_error_abort",&flg1,NULL);
376: if (flg1) {
377: MPI_Comm_set_errhandler(PETSC_COMM_WORLD,MPI_ERRORS_ARE_FATAL);
378: PetscPushErrorHandler(PetscAbortErrorHandler,0);
379: }
380: flg1 = PETSC_FALSE;
381: PetscOptionsGetBool(NULL,"-on_error_mpiabort",&flg1,NULL);
382: if (flg1) { PetscPushErrorHandler(PetscMPIAbortErrorHandler,0);}
383: flg1 = PETSC_FALSE;
384: PetscOptionsGetBool(NULL,"-mpi_return_on_error",&flg1,NULL);
385: if (flg1) {
386: MPI_Comm_set_errhandler(comm,MPI_ERRORS_RETURN);
387: }
388: flg1 = PETSC_FALSE;
389: PetscOptionsGetBool(NULL,"-no_signal_handler",&flg1,NULL);
390: if (!flg1) {PetscPushSignalHandler(PetscSignalHandlerDefault,(void*)0);}
391: flg1 = PETSC_FALSE;
392: PetscOptionsGetBool(NULL,"-fp_trap",&flg1,NULL);
393: if (flg1) {PetscSetFPTrap(PETSC_FP_TRAP_ON);}
394: PetscOptionsGetInt(NULL,"-check_pointer_intensity",&intensity,&flag);
397: /*
398: Setup debugger information
399: */
400: PetscSetDefaultDebugger();
401: PetscOptionsGetString(NULL,"-on_error_attach_debugger",string,64,&flg1);
402: if (flg1) {
403: MPI_Errhandler err_handler;
405: PetscSetDebuggerFromString(string);
406: MPI_Comm_create_errhandler((MPI_Handler_function*)Petsc_MPI_DebuggerOnError,&err_handler);
407: MPI_Comm_set_errhandler(comm,err_handler);
408: PetscPushErrorHandler(PetscAttachDebuggerErrorHandler,0);
409: }
410: PetscOptionsGetString(NULL,"-debug_terminal",string,64,&flg1);
411: if (flg1) { PetscSetDebugTerminal(string); }
412: PetscOptionsGetString(NULL,"-start_in_debugger",string,64,&flg1);
413: PetscOptionsGetString(NULL,"-stop_for_debugger",string,64,&flg2);
414: if (flg1 || flg2) {
415: PetscMPIInt size;
416: PetscInt lsize,*nodes;
417: MPI_Errhandler err_handler;
418: /*
419: we have to make sure that all processors have opened
420: connections to all other processors, otherwise once the
421: debugger has stated it is likely to receive a SIGUSR1
422: and kill the program.
423: */
424: MPI_Comm_size(PETSC_COMM_WORLD,&size);
425: if (size > 2) {
426: PetscMPIInt dummy = 0;
427: MPI_Status status;
428: for (i=0; i<size; i++) {
429: if (rank != i) {
430: MPI_Send(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD);
431: }
432: }
433: for (i=0; i<size; i++) {
434: if (rank != i) {
435: MPI_Recv(&dummy,1,MPI_INT,i,109,PETSC_COMM_WORLD,&status);
436: }
437: }
438: }
439: /* check if this processor node should be in debugger */
440: PetscMalloc1(size,&nodes);
441: lsize = size;
442: PetscOptionsGetIntArray(NULL,"-debugger_nodes",nodes,&lsize,&flag);
443: if (flag) {
444: for (i=0; i<lsize; i++) {
445: if (nodes[i] == rank) { flag = PETSC_FALSE; break; }
446: }
447: }
448: if (!flag) {
449: PetscSetDebuggerFromString(string);
450: PetscPushErrorHandler(PetscAbortErrorHandler,0);
451: if (flg1) {
452: PetscAttachDebugger();
453: } else {
454: PetscStopForDebugger();
455: }
456: MPI_Comm_create_errhandler((MPI_Handler_function*)Petsc_MPI_AbortOnError,&err_handler);
457: MPI_Comm_set_errhandler(comm,err_handler);
458: }
459: PetscFree(nodes);
460: }
462: PetscOptionsGetString(NULL,"-on_error_emacs",emacsmachinename,128,&flg1);
463: if (flg1 && !rank) {PetscPushErrorHandler(PetscEmacsClientErrorHandler,emacsmachinename);}
465: /*
466: Setup profiling and logging
467: */
468: #if defined(PETSC_USE_INFO)
469: {
470: char logname[PETSC_MAX_PATH_LEN]; logname[0] = 0;
471: PetscOptionsGetString(NULL,"-info",logname,250,&flg1);
472: if (flg1 && logname[0]) {
473: PetscInfoAllow(PETSC_TRUE,logname);
474: } else if (flg1) {
475: PetscInfoAllow(PETSC_TRUE,NULL);
476: }
477: }
478: #endif
479: #if defined(PETSC_USE_LOG)
480: mname[0] = 0;
481: PetscOptionsGetString(NULL,"-history",mname,PETSC_MAX_PATH_LEN,&flg1);
482: if (flg1) {
483: if (mname[0]) {
484: PetscOpenHistoryFile(mname,&petsc_history);
485: } else {
486: PetscOpenHistoryFile(NULL,&petsc_history);
487: }
488: }
489: #if defined(PETSC_HAVE_MPE)
490: flg1 = PETSC_FALSE;
491: PetscOptionsHasName(NULL,"-log_mpe",&flg1);
492: if (flg1) {PetscLogMPEBegin();}
493: #endif
494: flg1 = PETSC_FALSE;
495: flg2 = PETSC_FALSE;
496: flg3 = PETSC_FALSE;
497: PetscOptionsGetBool(NULL,"-log_all",&flg1,NULL);
498: PetscOptionsGetBool(NULL,"-log",&flg2,NULL);
499: PetscOptionsHasName(NULL,"-log_summary",&flg3);
500: PetscOptionsHasName(NULL,"-log_view",&flg4);
501: if (flg1) { PetscLogAllBegin(); }
502: else if (flg2 || flg3 || flg4) { PetscLogBegin();}
504: PetscOptionsGetString(NULL,"-log_trace",mname,250,&flg1);
505: if (flg1) {
506: char name[PETSC_MAX_PATH_LEN],fname[PETSC_MAX_PATH_LEN];
507: FILE *file;
508: if (mname[0]) {
509: sprintf(name,"%s.%d",mname,rank);
510: PetscFixFilename(name,fname);
511: file = fopen(fname,"w");
512: if (!file) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to open trace file: %s",fname);
513: } else file = PETSC_STDOUT;
515: PetscLogTraceBegin(file);
516: }
517: #endif
519: PetscOptionsGetBool(NULL,"-saws_options",&PetscOptionsPublish,NULL);
521: #if defined(PETSC_HAVE_CUDA)
522: PetscOptionsHasName(NULL,"-cuda_show_devices",&flg1);
523: if (flg1) {
524: struct cudaDeviceProp prop;
525: int devCount;
526: int device;
527: cudaError_t err = cudaSuccess;
528: err = cudaGetDeviceCount(&devCount);
529: if (err != cudaSuccess)
530: SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SYS,"error in cudaGetDeviceCount %s",cudaGetErrorString(err));
531: for (device = 0; device < devCount; ++device) {
532: err = cudaGetDeviceProperties(&prop, device);
533: if (err != cudaSuccess)
534: SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SYS,"error in cudaGetDeviceProperties %s",cudaGetErrorString(err));
535: PetscPrintf(PETSC_COMM_WORLD, "CUDA device %d: %s\n", device, prop.name);
536: }
537: }
538: {
539: int size;
540: MPI_Comm_size(PETSC_COMM_WORLD,&size);
541: if (size>1) {
542: int devCount, device, rank;
543: cudaError_t err = cudaSuccess;
545: /* check to see if we force multiple ranks to hit the same GPU */
546: PetscOptionsGetInt(NULL,"-cuda_set_device", &device, &flg1);
547: if (flg1) {
548: cudaSetDevice(device);
549: if (err != cudaSuccess)
550: SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SYS,"error in cudaSetDevice %s",cudaGetErrorString(err));
551: } else {
552: /* we're not using the same GPU on multiple MPI threads. So try to allocated different
553: GPUs to different threads */
555: /* First get the device count */
556: err = cudaGetDeviceCount(&devCount);
557: if (err != cudaSuccess)
558: SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SYS,"error in cudaGetDeviceCount %s",cudaGetErrorString(err));
560: /* next determine the rank and then set the device via a mod */
561: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
562: device = rank % devCount;
563: err = cudaSetDevice(device);
564: if (err != cudaSuccess)
565: SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SYS,"error in cudaSetDevice %s",cudaGetErrorString(err));
566: }
568: /* set the device flags so that it can map host memory ... do NOT throw exception on err!=cudaSuccess
569: multiple devices may try to set the flags on the same device. So long as one of them succeeds, things
570: are ok. */
571: err = cudaSetDeviceFlags(cudaDeviceMapHost);
573: } else {
574: int device;
575: cudaError_t err = cudaSuccess;
577: /* the code below works for serial GPU simulations */
578: PetscOptionsGetInt(NULL,"-cuda_set_device", &device, &flg1);
579: if (flg1) {
580: cudaSetDevice(device);
581: }
583: /* set the device flags so that it can map host memory ... here, we error check. */
584: err = cudaSetDeviceFlags(cudaDeviceMapHost);
585: if (err != cudaSuccess)
586: SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SYS,"error in cudaSetDevice %s",cudaGetErrorString(err));
587: }
588: }
589: #endif
592: /*
593: Print basic help message
594: */
595: PetscOptionsHasName(NULL,"-help",&flg1);
596: if (flg1) {
597: (*PetscHelpPrintf)(comm,"Options for all PETSc programs:\n");
598: (*PetscHelpPrintf)(comm," -help: prints help method for each option\n");
599: (*PetscHelpPrintf)(comm," -on_error_abort: cause an abort when an error is detected. Useful \n ");
600: (*PetscHelpPrintf)(comm," only when run in the debugger\n");
601: (*PetscHelpPrintf)(comm," -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm]\n");
602: (*PetscHelpPrintf)(comm," start the debugger in new xterm\n");
603: (*PetscHelpPrintf)(comm," unless noxterm is given\n");
604: (*PetscHelpPrintf)(comm," -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm]\n");
605: (*PetscHelpPrintf)(comm," start all processes in the debugger\n");
606: (*PetscHelpPrintf)(comm," -on_error_emacs <machinename>\n");
607: (*PetscHelpPrintf)(comm," emacs jumps to error file\n");
608: (*PetscHelpPrintf)(comm," -debugger_nodes [n1,n2,..] Nodes to start in debugger\n");
609: (*PetscHelpPrintf)(comm," -debugger_pause [m] : delay (in seconds) to attach debugger\n");
610: (*PetscHelpPrintf)(comm," -stop_for_debugger : prints message on how to attach debugger manually\n");
611: (*PetscHelpPrintf)(comm," waits the delay for you to attach\n");
612: (*PetscHelpPrintf)(comm," -display display: Location where X window graphics and debuggers are displayed\n");
613: (*PetscHelpPrintf)(comm," -no_signal_handler: do not trap error signals\n");
614: (*PetscHelpPrintf)(comm," -mpi_return_on_error: MPI returns error code, rather than abort on internal error\n");
615: (*PetscHelpPrintf)(comm," -fp_trap: stop on floating point exceptions\n");
616: (*PetscHelpPrintf)(comm," note on IBM RS6000 this slows run greatly\n");
617: (*PetscHelpPrintf)(comm," -malloc_dump <optional filename>: dump list of unfreed memory at conclusion\n");
618: (*PetscHelpPrintf)(comm," -malloc: use our error checking malloc\n");
619: (*PetscHelpPrintf)(comm," -malloc no: don't use error checking malloc\n");
620: (*PetscHelpPrintf)(comm," -malloc_info: prints total memory usage\n");
621: (*PetscHelpPrintf)(comm," -malloc_log: keeps log of all memory allocations\n");
622: (*PetscHelpPrintf)(comm," -malloc_debug: enables extended checking for memory corruption\n");
623: (*PetscHelpPrintf)(comm," -options_table: dump list of options inputted\n");
624: (*PetscHelpPrintf)(comm," -options_left: dump list of unused options\n");
625: (*PetscHelpPrintf)(comm," -options_left no: don't dump list of unused options\n");
626: (*PetscHelpPrintf)(comm," -tmp tmpdir: alternative /tmp directory\n");
627: (*PetscHelpPrintf)(comm," -shared_tmp: tmp directory is shared by all processors\n");
628: (*PetscHelpPrintf)(comm," -not_shared_tmp: each processor has separate tmp directory\n");
629: (*PetscHelpPrintf)(comm," -memory_info: print memory usage at end of run\n");
630: (*PetscHelpPrintf)(comm," -server <port>: Run PETSc webserver (default port is 8080) see PetscWebServe()\n");
631: #if defined(PETSC_USE_LOG)
632: (*PetscHelpPrintf)(comm," -get_total_flops: total flops over all processors\n");
633: (*PetscHelpPrintf)(comm," -log[_summary _summary_python]: logging objects and events\n");
634: (*PetscHelpPrintf)(comm," -log_trace [filename]: prints trace of all PETSc calls\n");
635: #if defined(PETSC_HAVE_MPE)
636: (*PetscHelpPrintf)(comm," -log_mpe: Also create logfile viewable through Jumpshot\n");
637: #endif
638: (*PetscHelpPrintf)(comm," -info <optional filename>: print informative messages about the calculations\n");
639: #endif
640: (*PetscHelpPrintf)(comm," -v: prints PETSc version number and release date\n");
641: (*PetscHelpPrintf)(comm," -options_file <file>: reads options from file\n");
642: (*PetscHelpPrintf)(comm," -petsc_sleep n: sleeps n seconds before running program\n");
643: (*PetscHelpPrintf)(comm,"-----------------------------------------------\n");
644: }
646: #if defined(PETSC_HAVE_POPEN)
647: {
648: char machine[128];
649: PetscOptionsGetString(NULL,"-popen_machine",machine,128,&flg1);
650: if (flg1) {
651: PetscPOpenSetMachine(machine);
652: }
653: }
654: #endif
656: PetscOptionsGetReal(NULL,"-petsc_sleep",&si,&flg1);
657: if (flg1) {
658: PetscSleep(si);
659: }
661: PetscOptionsGetString(NULL,"-info_exclude",mname,PETSC_MAX_PATH_LEN,&flg1);
662: PetscStrstr(mname,"null",&f);
663: if (f) {
664: PetscInfoDeactivateClass(0);
665: }
667: #if defined(PETSC_HAVE_CUSP) || defined(PETSC_HAVE_VIENNACL)
668: PetscOptionsHasName(NULL,"-log_summary",&flg3);
669: if (!flg3) {
670: PetscOptionsHasName(NULL,"-log_view",&flg3);
671: }
672: #endif
673: #if defined(PETSC_HAVE_CUSP)
674: PetscOptionsGetBool(NULL,"-cusp_synchronize",&flg3,NULL);
675: PetscCUSPSynchronize = flg3;
676: #elif defined(PETSC_HAVE_VIENNACL)
677: PetscOptionsGetBool(NULL,"-viennacl_synchronize",&flg3,NULL);
678: PetscViennaCLSynchronize = flg3;
679: #endif
680: return(0);
681: }