[97] | 1 | .\"Copyright 2006-2008 Sun Microsystems, Inc. |
---|
| 2 | .\" Copyright (c) 1996 Thinking Machines Corporation |
---|
| 3 | .TH MPI_Init_thread 3 "Dec 08, 2009" "1.4" "Open MPI" |
---|
| 4 | |
---|
| 5 | .SH NAME |
---|
| 6 | \fBMPI_Init_thread\fP \- Initializes the MPI execution environment |
---|
| 7 | |
---|
| 8 | .SH SYNTAX |
---|
| 9 | .ft R |
---|
| 10 | |
---|
| 11 | .SH C Syntax |
---|
| 12 | .nf |
---|
| 13 | #include <mpi.h> |
---|
| 14 | int MPI_Init_thread(int *\fIargc\fP, char ***\fIargv\fP, |
---|
| 15 | int \fIrequired\fP, int *\fIprovided\fP) |
---|
| 16 | |
---|
| 17 | .SH Fortran Syntax |
---|
| 18 | .nf |
---|
| 19 | INCLUDE 'mpif.h' |
---|
| 20 | MPI_INIT(\fIREQUIRED, PROVIDED, IERROR\fP) |
---|
| 21 | INTEGER \fIREQUIRED, PROVIDED, IERROR\fP |
---|
| 22 | |
---|
| 23 | .SH C++ Syntax |
---|
| 24 | .nf |
---|
| 25 | #include <mpi.h> |
---|
| 26 | int MPI::Init_thread(int& \fIargc\fP, char**& \fIargv\fP, int \fIrequired\fP) |
---|
| 27 | int MPI::Init_thread(int \fIrequired\fP) |
---|
| 28 | |
---|
| 29 | .SH INPUT PARAMETERS |
---|
| 30 | .ft R |
---|
| 31 | .TP 1i |
---|
| 32 | argc |
---|
| 33 | C/C++ only: Pointer to the number of arguments. |
---|
| 34 | .TP 1i |
---|
| 35 | argv |
---|
| 36 | C/C++ only: Argument vector. |
---|
| 37 | .TP 1i |
---|
| 38 | required |
---|
| 39 | Desired level of thread support (integer). |
---|
| 40 | |
---|
| 41 | .SH OUTPUT PARAMETERS |
---|
| 42 | .ft R |
---|
| 43 | .TP 1i |
---|
| 44 | provided |
---|
| 45 | Available level of thread support (integer). |
---|
| 46 | .TP 1i |
---|
| 47 | IERROR |
---|
| 48 | Fortran only: Error status (integer). |
---|
| 49 | |
---|
| 50 | .SH DESCRIPTION |
---|
| 51 | .ft R |
---|
| 52 | This routine, or MPI_Init, must be called before any other MPI routine |
---|
| 53 | (apart from MPI_Initialized) is called. MPI can be initialized at most |
---|
| 54 | once; subsequent calls to MPI_Init or MPI_Init_thread are erroneous. |
---|
| 55 | .sp |
---|
| 56 | MPI_Init_thread, as compared to MPI_Init, has a provision to request a |
---|
| 57 | certain level of thread support in \fIrequired\fP: |
---|
| 58 | .TP 2.4i |
---|
| 59 | MPI_THREAD_SINGLE |
---|
| 60 | Only one thread will execute. |
---|
| 61 | .TP 2.4i |
---|
| 62 | MPI_THREAD_FUNNELED |
---|
| 63 | If the process is multithreaded, only the thread that called |
---|
| 64 | MPI_Init_thread will make MPI calls. |
---|
| 65 | .TP 2.4i |
---|
| 66 | MPI_THREAD_SERIALIZED |
---|
| 67 | If the process is multithreaded, only one thread will make MPI library |
---|
| 68 | calls at one time. |
---|
| 69 | .TP 2.4i |
---|
| 70 | MPI_THREAD_MULTIPLE |
---|
| 71 | If the process is multithreaded, multiple threads may call MPI at once |
---|
| 72 | with no restrictions. |
---|
| 73 | .SH |
---|
| 74 | The level of thread support available to the program is set in |
---|
| 75 | \fIprovided\fP, except in C++, where it is the return value of the |
---|
| 76 | function. In Open MPI, the value is dependent on how the library was configured and built. Note that there is no guarantee that \fIprovided\fP will be greater than or equal to |
---|
| 77 | \fIrequired\fP. |
---|
| 78 | .sp |
---|
| 79 | All MPI programs must contain a call to MPI_Init or |
---|
| 80 | MPI_Init_thread. Open MPI accepts the C/C++ \fIargc\fP and \fIargv\fP |
---|
| 81 | arguments to main, but neither modifies, interprets, nor distributes |
---|
| 82 | them: |
---|
| 83 | .sp |
---|
| 84 | .nf |
---|
| 85 | { |
---|
| 86 | /* declare variables */ |
---|
| 87 | MPI_Init_thread(&argc, &argv, req, &prov); |
---|
| 88 | /* parse arguments */ |
---|
| 89 | /* main program */ |
---|
| 90 | MPI_Finalize(); |
---|
| 91 | } |
---|
| 92 | .fi |
---|
| 93 | |
---|
| 94 | .SH NOTES |
---|
| 95 | .ft R |
---|
| 96 | The Fortran version does not have provisions for \fIargc\fP and |
---|
| 97 | \fIargv\fP and takes only IERROR. |
---|
| 98 | .sp |
---|
| 99 | It is the caller's responsibility to check the value of \fIprovided\fP, |
---|
| 100 | as it may be less than what was requested in \fIrequired\fP. |
---|
| 101 | .sp |
---|
| 102 | The MPI Standard does not say what a program can do before an |
---|
| 103 | MPI_Init_thread or after an MPI_Finalize. In the Open MPI |
---|
| 104 | implementation, it should do as little as possible. In particular, |
---|
| 105 | avoid anything that changes the external state of the program, such as |
---|
| 106 | opening files, reading standard input, or writing to standard output. |
---|
| 107 | |
---|
| 108 | .SH ERRORS |
---|
| 109 | .ft R |
---|
| 110 | Almost all MPI routines return an error value; C routines as |
---|
| 111 | the value of the function and Fortran routines in the last argument. C++ |
---|
| 112 | functions do not return errors. If the default error handler is set to |
---|
| 113 | MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism |
---|
| 114 | will be used to throw an MPI:Exception object. |
---|
| 115 | .sp |
---|
| 116 | Before the error value is returned, the current MPI error handler is |
---|
| 117 | called. By default, this error handler aborts the MPI job, except for |
---|
| 118 | I/O function errors. The error handler may be changed with |
---|
| 119 | MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN |
---|
| 120 | may be used to cause error values to be returned. Note that MPI does not |
---|
| 121 | guarantee that an MPI program can continue past an error. |
---|
| 122 | |
---|
| 123 | .SH SEE ALSO |
---|
| 124 | .ft R |
---|
| 125 | .nf |
---|
| 126 | MPI_Init |
---|
| 127 | MPI_Initialized |
---|
| 128 | MPI_Finalize |
---|
| 129 | |
---|