File: PetscInitialize.html

package info (click to toggle)
petsc 2.3.3-14
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 79,788 kB
  • ctags: 339,579
  • sloc: ansic: 255,388; cpp: 27,384; python: 27,194; fortran: 18,468; makefile: 11,436; sh: 3,671; f90: 1,447; xml: 620; csh: 211
file content (147 lines) | stat: -rw-r--r-- 9,812 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>PetscInitialize</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<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 "petsc.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 <A HREF="../Sys/PETSC_NULL.html#PETSC_NULL">PETSC_NULL</A> 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 <A HREF="../Sys/PETSC_NULL.html#PETSC_NULL">PETSC_NULL</A> for no message
</TD></TR></TABLE>
<P>
If you wish PETSc to run 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>()
<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>-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></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Options Database Keys for Profiling</FONT></H3>
See the Profiling chapter of the users manual for details.
<TABLE border="0" cellpadding="0" cellspacing="0">
<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>-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></TABLE>
<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">C++ variants</FONT></H3><TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD>&nbsp PetscInitialize(int *argc,char ***args)<TD WIDTH=20></TD><TD>-></TD><TD WIDTH=20></TD><TD>PetscInitialize(argc,args,PETSC_NULL,PETSC_NULL)</TR></TD>

</TABLE>
<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 PETSC_CHARACTER_NULL to not check for
code specific file. Use -skip_petscrc in the code specific file to skip the .petscrc files
</TD></TR></TABLE>
<H3><FONT COLOR="#CC3333">Important Fortran Note</FONT></H3>
In Fortran, you MUST use PETSC_NULL_CHARACTER to indicate a
null character string; you CANNOT just use <A HREF="../Sys/PETSC_NULL.html#PETSC_NULL">PETSC_NULL</A> as
in the C version.  See the users manual for details.
<P>
<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>()
<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/viewer/examples/tutorials/ex1f90.F90.html">src/sys/viewer/examples/tutorials/ex1f90.F90.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/ex5.c.html">src/sys/examples/tutorials/ex5.c.html</A><BR>
<A HREF="../../../src/sys/examples/tutorials/ex3f.F.html">src/sys/examples/tutorials/ex3f.F.html</A><BR>
<A HREF="../../../src/sys/examples/tutorials/ex5f90.F90.html">src/sys/examples/tutorials/ex5f90.F90.html</A><BR>
<A HREF="../../../src/vec/vec/examples/tutorials/ex1.c.html">src/vec/vec/examples/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/vec/vec/examples/tutorials/ex1e.c.html">src/vec/vec/examples/tutorials/ex1e.c.html</A><BR>
<A HREF="../../../src/vec/vec/examples/tutorials/ex2.c.html">src/vec/vec/examples/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/vec/vec/examples/tutorials/ex3.c.html">src/vec/vec/examples/tutorials/ex3.c.html</A><BR>
</BODY></HTML>