<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="DOCTEXT"> <TITLE>MPI_Init</TITLE> </HEAD> <BODY BGCOLOR="FFFFFF"> <A NAME="MPI_Init"><H1>MPI_Init</H1></A> 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 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><P><B>Location:</B>init.c<P> </BODY></HTML>