1MPI_Init_thread(3)                  LAM/MPI                 MPI_Init_thread(3)
2
3
4

NAME

6       MPI_Init_thread -  Initialize the MPI execution environment
7

SYNOPSIS

9       #include <mpi.h>
10       int
11       MPI_Init_thread(int *pargc, char ***pargv, int requested, int *pprovided)
12

INPUT PARAMETERS

14       pargc  - Pointer to the number of arguments
15       pargv  - Pointer to the argument vector
16       requested
17              - Desired level of thread support
18       pprovided
19              - Given level of thread support
20
21

NOTES

23       LAM  currently supports MPI_THREAD_SINGLE , MPI_THREAD_SERIALIZED , and
24       MPI_THREAD_FUNNELED .  MPI_THREAD_MULTIPLE is not yet  supported.   The
25       use  of  MPI_INIT_THREAD  is  recommended instead of MPI_INIT if an MPI
26       program   is   going    to    be    multi-threaded.     However,    the
27       LAM_MPI_THREAD_LEVEL  environment  variable  can  be  used  to the same
28       effect.  See MPI_Init(3) for more details.
29
30       There  is  currently  no  distinction  between  MPI_THREAD_SINGLE   and
31       MPI_THREAD_FUNNELED  .   An application using MPI_THREAD_FUNNELED prom‐
32       ises to never call MPI from  a  different  thread  than  the  one  that
33       invoked MPI_INIT (or MPI_INIT_THREAD ).  LAM does no checking to ensure
34       that this is true.  As such, no locks are placed around  MPI  calls  to
35       ensure  that  only  one thread is making MPI calls at a time (since the
36       application has promised that  only  one  thread  will  be  making  MPI
37       calls).
38
39       Using  MPI_THREAD_SERIALIZED  will  cause LAM to place locks around all
40       MPI calls such that only one thread will  be  able  to  enter  the  MPI
41       library  at  a time; beware of this fact for portability with other MPI
42       implementations.  Even with multiple threads, deadlock is still  possi‐
43       ble  when  using MPI_THREAD_SERIALIZED -- applications still need to be
44       aware of this and code appropriately.
45
46       Other than this  restriction,  this  function  behaves  identically  to
47       MPI_INIT (see MPI_Init(3)).
48
49       Note  that both MPI_INIT and MPI_INIT_THREAD are allowed to changed the
50       requested thread level based on lower-level device and SSI module  ini‐
51       tializations.   For  example,  if a user application invokes MPI_Init ,
52       some SSI modules may require threads and therefore upgrade  the  thread
53       support level to something higher than MPI_THREAD_SINGLE .
54
55
56

ERRORS

58       If an error occurs in an MPI function, the current MPI error handler is
59       called to handle it.  By default, this error  handler  aborts  the  MPI
60       job.   The  error  handler may be changed with MPI_Errhandler_set ; the
61       predefined error handler MPI_ERRORS_RETURN may be used to  cause  error
62       values  to  be  returned  (in C and Fortran; this error handler is less
63       useful in with the C++ MPI  bindings.   The  predefined  error  handler
64       MPI::ERRORS_THROW_EXCEPTIONS  should  be used in C++ if the error value
65       needs to be recovered).  Note that MPI does not guarantee that  an  MPI
66       program can continue past an error.
67
68       All  MPI  routines  (except  MPI_Wtime  and MPI_Wtick ) return an error
69       value; C routines as the value of the function and Fortran routines  in
70       the  last  argument.  The C++ bindings for MPI do not return error val‐
71       ues; instead, error values are communicated by throwing  exceptions  of
72       type  MPI::Exception  (but not by default).  Exceptions are only thrown
73       if the error value is not MPI::SUCCESS .
74
75
76       Note that if the MPI::ERRORS_RETURN handler is set in  C++,  while  MPI
77       functions  will  return  upon an error, there will be no way to recover
78       what the actual error value was.
79       MPI_SUCCESS
80              - No error; MPI routine completed successfully.
81       MPI_ERR_ARG
82              - Invalid argument.  Some argument is invalid and is not identi‐
83              fied  by  a  specific  error  class.   This  is typically a NULL
84              pointer or other such error.
85       MPI_ERR_OTHER
86              - This error class is associated with an error code  that  indi‐
87              cates  that  an attempt was made to call MPI_INIT a second time.
88              MPI_INIT may only be called once in a program.
89       MPI_ERR_OTHER
90              - Other error; use  MPI_Error_string  to  get  more  information
91              about this error code.
92
93

SEE ALSO

95       MPI_Init, MPI_Finalize, lamboot, mpirun, lamhalt, lamssi
96
97

MORE INFORMATION

99       For more information, please see the official MPI Forum web site, which
100       contains the text of both the MPI-1 and MPI-2 standards.   These  docu‐
101       ments  contain  detailed  information  about each MPI function (most of
102       which is not duplicated in these man pages).
103
104       http://www.mpi-forum.org/
105
106
107

ACKNOWLEDGEMENTS

109       The LAM Team would like the thank the MPICH Team for the handy  program
110       to  generate  man  pages ("doctext" from ftp://ftp.mcs.anl.gov/pub/sow‐
111       ing/sowing.tar.gz ), the initial formatting, and some initial text  for
112       most of the MPI-1 man pages.
113

LOCATION

115       initthr.c
116
117
118
119LAM/MPI 7.1.2                      2/23/2006                MPI_Init_thread(3)
Impressum