File: PetscInitialize.html

package info (click to toggle)
petsc 3.4.2.dfsg1-8.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 129,104 kB
  • ctags: 516,422
  • sloc: ansic: 395,939; cpp: 47,201; python: 34,788; makefile: 17,193; fortran: 16,251; f90: 1,592; objc: 954; sh: 822; xml: 621; java: 381; lisp: 293; csh: 241
file content (168 lines) | stat: -rw-r--r-- 12,284 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInitialize.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>PetscInitialize</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
   <div id="version" align=right><b>petsc-3.4.2 2013-07-02</b></div>
<A NAME="PetscInitialize"><H1>PetscInitialize</H1></A>
Initializes the PETSc database and MPI. <A HREF="../Sys/PetscInitialize.html#PetscInitialize">PetscInitialize</A>() calls MPI_Init() if that has yet to be called, so this routine should always be called near the beginning of your program -- usually the very first line! 
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscsys.h"   
PetscErrorCode  PetscInitialize(int *argc,char ***args,const char file[],const char help[])
</PRE>
Collective on MPI_COMM_WORLD or <A HREF="../Sys/PETSC_COMM_WORLD.html#PETSC_COMM_WORLD">PETSC_COMM_WORLD</A> if it has been set
<P>
<H3><FONT COLOR="#CC3333">Input Parameters</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>argc </B></TD><TD>- count of number of command line arguments
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>args </B></TD><TD>- the command line arguments
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>file </B></TD><TD>- [optional] PETSc database file, also checks ~username/.petscrc and .petscrc use NULL to not check for
code specific file. Use -skip_petscrc in the code specific file to skip the .petscrc files
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>help </B></TD><TD>- [optional] Help message to print, use NULL for no message
</TD></TR></TABLE>
<P>
If you wish PETSc code to run ONLY on a subcommunicator of MPI_COMM_WORLD, create that
communicator first and assign it to <A HREF="../Sys/PETSC_COMM_WORLD.html#PETSC_COMM_WORLD">PETSC_COMM_WORLD</A> BEFORE calling <A HREF="../Sys/PetscInitialize.html#PetscInitialize">PetscInitialize</A>(). Thus if you are running a
four process job and two processes will run PETSc and have <A HREF="../Sys/PetscInitialize.html#PetscInitialize">PetscInitialize</A>() and <A HREF="../Sys/PetscFinalize.html#PetscFinalize">PetscFinalize</A>() and two process will not,
then do this. If ALL processes in the job are using <A HREF="../Sys/PetscInitialize.html#PetscInitialize">PetscInitialize</A>() and <A HREF="../Sys/PetscFinalize.html#PetscFinalize">PetscFinalize</A>() then you don't need to do this, even
if different subcommunicators of the job are doing different things with PETSc.
<P>
<H3><FONT COLOR="#CC3333">Options Database Keys</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-start_in_debugger [noxterm,dbx,xdb,gdb,...] </B></TD><TD>- Starts program in debugger
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-on_error_attach_debugger [noxterm,dbx,xdb,gdb,...] </B></TD><TD>- Starts debugger when error detected
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-on_error_emacs &lt;machinename&gt; causes emacsclient to jump to error file</B></TD><TD>- .  -on_error_abort calls abort() when error detected (no traceback)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-on_error_mpiabort calls MPI_abort() when error detected</B></TD><TD>- .  -error_output_stderr prints error messages to stderr instead of the default stdout
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-error_output_none does not print the error messages (but handles errors in the same way as if this was not called)</B></TD><TD>- .  -debugger_nodes [node1,node2,...] - Indicates nodes to start in debugger
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-debugger_pause [sleeptime] (in seconds) </B></TD><TD>- Pauses debugger
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-stop_for_debugger </B></TD><TD>- Print message on how to attach debugger manually to
process and wait (-debugger_pause) seconds for attachment
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-malloc </B></TD><TD>- Indicates use of PETSc error-checking malloc (on by default for debug version of libraries)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-malloc no </B></TD><TD>- Indicates not to use error-checking malloc
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-malloc_debug </B></TD><TD>- check for memory corruption at EVERY malloc or free
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-malloc_test </B></TD><TD>- like -malloc_dump -malloc_debug, but only active for debugging builds
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-fp_trap </B></TD><TD>- Stops on floating point exceptions (Note that on the
IBM RS6000 this slows code by at least a factor of 10.)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-no_signal_handler </B></TD><TD>- Indicates not to trap error signals
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-shared_tmp </B></TD><TD>- indicates /tmp directory is shared by all processors
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-not_shared_tmp </B></TD><TD>- each processor has own /tmp
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-tmp </B></TD><TD>- alternative name of /tmp directory
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-get_total_flops </B></TD><TD>- returns total flops done by all processors
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-memory_info </B></TD><TD>- Print memory usage at end of run
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-server &lt;port&gt; </B></TD><TD>- start PETSc webserver (default port is 8080)
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Options Database Keys for Profiling</FONT></H3>
See the &lt;a href="../../docs/manual.pdf#nameddest=<A HREF="../../manual.pdf#chapter.10">Chapter 10 Profiling</A>"&gt;profiling chapter of the users manual&lt;/a&gt; for details.
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-info &lt;optional filename&gt; </B></TD><TD>- Prints verbose information to the screen
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-info_exclude &lt;null,vec,mat,pc,ksp,snes,ts&gt; </B></TD><TD>- Excludes some of the verbose messages
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-log_sync </B></TD><TD>- Log the synchronization in scatters, inner products and norms
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-log_trace [filename] </B></TD><TD>- Print traces of all PETSc calls to the screen (useful to determine where a program
hangs without running in the debugger).  See <A HREF="../Profiling/PetscLogTraceBegin.html#PetscLogTraceBegin">PetscLogTraceBegin</A>().
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-log_summary [filename] </B></TD><TD>- Prints summary of flop and timing information to screen. If the filename is specified the
summary is written to the file.  See PetscLogView().
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-log_summary_python [filename] </B></TD><TD>- Prints data on of flop and timing usage to a file or screen. See PetscLogPrintSViewPython().
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-log_all [filename] </B></TD><TD>- Logs extensive profiling information  See <A HREF="../Profiling/PetscLogDump.html#PetscLogDump">PetscLogDump</A>().
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-log [filename] </B></TD><TD>- Logs basic profiline information  See <A HREF="../Profiling/PetscLogDump.html#PetscLogDump">PetscLogDump</A>().
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-log_mpe [filename] </B></TD><TD>- Creates a logfile viewable by the utility Jumpshot (in MPICH distribution)
</TD></TR></TABLE>
<P>
Only one of -log_trace, -log_summary, -log_all, -log, or -log_mpe may be used at a time
<P>
<H3><FONT COLOR="#CC3333">Environmental Variables</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_TMP </B></TD><TD>- alternative tmp directory
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_SHARED_TMP </B></TD><TD>- tmp is shared by all processes
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_NOT_SHARED_TMP </B></TD><TD>- each process has its own private tmp
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_VIEWER_SOCKET_PORT </B></TD><TD>- socket number to use for socket viewer
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_VIEWER_SOCKET_MACHINE </B></TD><TD>- machine to use for socket viewer to connect to
</TD></TR></TABLE>
<P>
<P>

<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
If for some reason you must call MPI_Init() separately, call
it before <A HREF="../Sys/PetscInitialize.html#PetscInitialize">PetscInitialize</A>().
<P>
<H3><FONT COLOR="#CC3333">Fortran Version</FONT></H3>
In Fortran this routine has the format
<pre>
      call <A HREF="../Sys/PetscInitialize.html#PetscInitialize">PetscInitialize</A>(file,ierr)
</pre>
<P>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>ierr </B></TD><TD>- error return code
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>file </B></TD><TD>- [optional] PETSc database file, also checks ~username/.petscrc and .petscrc use NULL_CHARACTER to not check for
code specific file. Use -skip_petscrc in the code specific file to skip the .petscrc files
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Important Fortran Note</FONT></H3>
In Fortran, you MUST use NULL_CHARACTER to indicate a
null character string; you CANNOT just use NULL as
in the C version. See the &lt;a href="../../docs/manual.pdf"&gt;users manual&lt;/a&gt; for details.
<P>
If your main program is C but you call Fortran code that also uses PETSc you need to call PetscInitializeFortran() soon after
calling <A HREF="../Sys/PetscInitialize.html#PetscInitialize">PetscInitialize</A>().
<P>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
 <A HREF="../Sys/PetscFinalize.html#PetscFinalize">PetscFinalize</A>(), PetscInitializeFortran(), <A HREF="../Sys/PetscGetArgs.html#PetscGetArgs">PetscGetArgs</A>(), <A HREF="../Sys/PetscInitializeNoArguments.html#PetscInitializeNoArguments">PetscInitializeNoArguments</A>()
<BR>
<P>
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>beginner
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/sys/objects/pinit.c.html#PetscInitialize">src/sys/objects/pinit.c</A>
<BR><A HREF="./index.html">Index of all Sys routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/sys/classes/viewer/examples/tutorials/ex1.c.html">src/sys/classes/viewer/examples/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/sys/classes/viewer/examples/tutorials/ex2.c.html">src/sys/classes/viewer/examples/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/sys/classes/viewer/examples/tutorials/ex1f90.F90.html">src/sys/classes/viewer/examples/tutorials/ex1f90.F90.html</A><BR>
<A HREF="../../../src/sys/classes/random/examples/tutorials/ex1.c.html">src/sys/classes/random/examples/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/sys/classes/random/examples/tutorials/ex2.c.html">src/sys/classes/random/examples/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/sys/examples/tutorials/ex1.c.html">src/sys/examples/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/sys/examples/tutorials/ex2.c.html">src/sys/examples/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/sys/examples/tutorials/ex3.c.html">src/sys/examples/tutorials/ex3.c.html</A><BR>
<A HREF="../../../src/sys/examples/tutorials/ex4.c.html">src/sys/examples/tutorials/ex4.c.html</A><BR>
<A HREF="../../../src/sys/examples/tutorials/ex5.c.html">src/sys/examples/tutorials/ex5.c.html</A><BR>
<A HREF="../../../src/sys/examples/tutorials/ex6.c.html">src/sys/examples/tutorials/ex6.c.html</A><BR>
</BODY></HTML>