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