📄 mpi_init_thread.3
字号:
.\"Copyright 2006, Sun Microsystems, Inc..\" Copyright (c) 1996 Thinking Machines Corporation.TH MPI_Init_thread 3OpenMPI "September 2006" "Open MPI 1.2" " ".SH NAME\fBMPI_Init_thread\fP \- Initializes the MPI execution environment.SH SYNTAX.ft R.SH C Syntax.nf#include <mpi.h>int MPI_Init_thread(int *\fIargc\fP, char ***\fIargv\fP, int \fIrequired\fP, int *\fIprovided\fP).SH Fortran Syntax.nfINCLUDE 'mpif.h'MPI_INIT(\fIREQUIRED, PROVIDED, IERROR\fP) INTEGER \fIREQUIRED, PROVIDED, IERROR\fP .SH C++ Syntax.nf#include <mpi.h>int MPI::Init_thread(int& \fIargc\fP, char**& \fIargv\fP, int \fIrequired\fP)int MPI::Init_thread(int \fIrequired\fP).SH INPUT PARAMETERS.ft R.TP 1iargcC/C++ only: Pointer to the number of arguments..TP 1iargvC/C++ only: Argument vector..TP 1irequiredDesired level of thread support (integer)..SH OUTPUT PARAMETERS.ft R.TP 1iprovidedAvailable level of thread support (integer)..TP 1iIERRORFortran only: Error status (integer). .SH DESCRIPTION.ft RThis routine, or MPI_Init, must be called before any other MPI routine(apart from MPI_Initialized) is called. MPI can be initialized at mostonce; subsequent calls to MPI_Init or MPI_Init_thread are erroneous..spMPI_Init_thread, as compared to MPI_Init, has a provision to request acertain level of thread support in \fIrequired\fP:.TP 2.4iMPI_THREAD_SINGLEOnly one thread will execute..TP 2.4iMPI_THREAD_FUNNELEDIf the process is multithreaded, only the thread that calledMPI_Init_thread will make MPI calls..TP 2.4iMPI_THREAD_SERIALIZEDIf the process is multithreaded, only one thread will make MPI librarycalls at one time..TP 2.4iMPI_THREAD_MULTIPLEIf the process is multithreaded, multiple threads may call MPI at oncewith no restrictions..SHThe level of thread support available to the program is set in\fIprovided\fP, except in C++, where it is the return value of thefunction. 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\fIrequired\fP..spAll MPI programs must contain a call to MPI_Init orMPI_Init_thread. Open MPI accepts the C/C++ \fIargc\fP and \fIargv\fParguments to main, but neither modifies, interprets, nor distributesthem:.sp.nf { /* declare variables */ MPI_Init_thread(&argc, &argv, req, &prov); /* parse arguments */ /* main program */ MPI_Finalize(); }.fi.SH NOTES.ft RThe Fortran version does not have provisions for \fIargc\fP and\fIargv\fP and takes only IERROR..spIt is the caller's responsibility to check the value of \fIprovided\fP,as it may be less than what was requested in \fIrequired\fP..spThe MPI Standard does not say what a program can do before anMPI_Init_thread or after an MPI_Finalize. In the Open MPIimplementation, it should do as little as possible. In particular,avoid anything that changes the external state of the program, such asopening files, reading standard input, or writing to standard output..SH ERRORS.ft RAlmost all MPI routines return an error value; C routines asthe value of the function and Fortran routines in the last argument. C++functions do not return errors. If the default error handler is set toMPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanismwill be used to throw an MPI:Exception object..spBefore the error value is returned, the current MPI error handler iscalled. By default, this error handler aborts the MPI job, except forI/O function errors. The error handler may be changed withMPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURNmay be used to cause error values to be returned. Note that MPI does notguarantee that an MPI program can continue past an error. .SH SEE ALSO.ft R.nfMPI_InitMPI_InitializedMPI_Finalize' @(#)MPI_Init_thread.3 1.6 06/03/09
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -