MPI_Init_thread function

Initializes the calling MPI process’s execution environment for threaded execution.

Syntax

int MPIAPI MPI_Init_thread(
  _In_opt_ int                        *argc,
           _In_opt_count_(*argc) char ***argv,
  _In_     int                        required,
  _Out_    int                        *provided
);

Parameters

  • argc [in, optional]
    A pointer to the number of arguments for the program. This value can be NULL.

  • argv [optional]
    A pointer to the argument list for the program. This value can be NULL.

  • required [in]
    The level of desired thread support. Multiple MPI processes in the same job may use different values.

    MPI_THREAD_SINGLE Only a single thread in the program will execute.
    MPI_THREAD_FUNNELED The process may contain multiple threads, but the thread that called MPI_Init_thread is the only one that makes MPI function calls.
    MPI_THREAD_SERIALIZED The process may contain multiple threads, and all of those threads may make MPI function calls, but only one at a time.
    MPI_THREAD_MULTIPLE Multiple application threads may call MPI functions with no restrictions. This value is currently only supported on MS-MPI V6 running on Windows Server 2012, Windows Server 2012 R2, Windows 8, and Windows 8.1.

     

  • provided [out]
    The level of provided thread support. The value returned will be from the table above.

     

Return value

MPI_SUCCESS if the function returns successfully. Other error codes if the call failed for other reasons (such as invalid arguments).

In Fortran the return value is stored in the IERROR parameter.

Fortran

    MPI_INIT_THREAD(REQUIRED, PROVIDED, IERROR)
        INTEGER REQUIRED, PROVIDED, IERROR

Remarks

This function must be called by one thread only. That thread will be known as the “Main Thread” and must be the same thread to call MPI_Finalize.

The Fortran binding of MPI_Init_thread does not accept the ARGC and ARGV parameters.

Requirements

Product

HPC Pack 2012 MS-MPI Redistributable Package, HPC Pack 2008 R2 MS-MPI Redistributable Package, HPC Pack 2008 MS-MPI Redistributable Package or HPC Pack 2008 Client Utilities

Header

Mpi.h; Mpif.h

Library

Msmpi.lib

DLL

Msmpi.dll

See also

MPI External Functions

MPI_Finalize

MPI_Init