Blob Blame History Raw
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MPI_Init</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<H1 id="MPI_Init">MPI_Init</H1>
Initialize the MPI execution environment 
<H2>Synopsis</H2>
<PRE>
int MPI_Init(int *argc, char ***argv)
</PRE>
<H2>Input Parameters</H2>
<DL>
<DT><B>argc </B> <DD> Pointer to the number of arguments

<DT><B>argv </B> <DD> Pointer to the argument vector
</DL>
<P>
<H2>Thread and Signal Safety</H2>
This routine must be called by one thread only.  That thread is called
the <em>main thread</em> and must be the thread that calls <tt>MPI_Finalize</tt>.
<P>
<H2>Notes</H2>
The MPI standard does not say what a program can do before an <tt>MPI_INIT</tt> or
after an <tt>MPI_FINALIZE</tt>.  In the MPICH implementation, you should do
as little as possible.  In particular, avoid anything that changes the
external state of the program, such as opening files, reading standard
input or writing to standard output.
<P>
<H2>Notes for C</H2>
As of MPI-2, <tt>MPI_Init</tt> will accept NULL as input parameters. Doing so
will impact the values stored in <tt>MPI_INFO_ENV</tt>.
<P>
<H2>Notes for Fortran</H2>
The Fortran binding for <tt>MPI_Init</tt> has only the error return
<PRE>
    subroutine MPI_INIT(ierr)
    integer ierr
</PRE>

<P>
<H2>Errors</H2>
<P>
All MPI routines (except <tt>MPI_Wtime</tt> and <tt>MPI_Wtick</tt>) return an error value;
C routines as the value of the function and Fortran routines in the last
argument.  Before the value is returned, the current MPI error handler is
called.  By default, this error handler aborts the MPI job.  The error handler
may be changed with <tt>MPI_Comm_set_errhandler</tt> (for communicators),
<tt>MPI_File_set_errhandler</tt> (for files), and <tt>MPI_Win_set_errhandler</tt> (for
RMA windows).  The MPI-1 routine <tt>MPI_Errhandler_set</tt> may be used but
its use is deprecated.  The predefined error handler
<tt>MPI_ERRORS_RETURN</tt> may be used to cause error values to be returned.
Note that MPI does <em>not</em> guarentee that an MPI program can continue past
an error; however, MPI implementations will attempt to continue whenever
possible.
<P>
<DL>
<DT><B>MPI_SUCCESS </B> <DD> No error; MPI routine completed successfully.
</DL>
<DL>
<DT><B>MPI_ERR_OTHER </B> <DD> This error class is associated with an error code that 
indicates that an attempt was made to call <tt>MPI_INIT</tt> a second time.
<tt>MPI_INIT</tt> may only be called once in a program.
</DL>
<P>
<H2>See Also</H2>
 MPI_Init_thread, MPI_Finalize
<br>
</BODY></HTML>