2.13.1.1. MPI Initialization

World Model. For programs where all processes coordinate together

int MPI_Init (int *argc, char ***argv);
int MPI_Init_thread (int *argc, char ***argv, int required, int *provided);
int MPI_Query_thread (int *provided);
int MPI_Is_thread_main (int *flag);
int MPI_Initialized (int *flag);
int MPI_Finalize (void);

MPI_THREAD_SIGNLE

single thread in this process

MPI_THREAD_FUNNELED

multiple threads but only main thread calls MPI

MPI_THREAD_SERIALIZED

multiple threads but only one MPI call at a time

MPI_THREAD_MULTIPLE

multiple threads and multiple MPI calls at a time

Session Model. For programs where processes coordinate within components

int MPI_Session_init (MPI_Info info, MPI_Errhandler errhandler, MPI_Session *session);
int MPI_Session_get_num_psets (MPI_Session session, MPI_Info info, int *npset_names);
int MPI_Session_get_nth_pset (MPI_Session session, MPI_Info info, int n, int *pset_len, char *pset_name);
int MPI_Session_finalize (MPI_Session *session);

Process sets are administratively defined groups of processes

Dynamic Process Model. For explicit control over process lifecycle

int MPI_Comm_spawn (
    const char *command, char *argv[], int maxprocs, MPI_Info info,
    int root, MPI_Comm comm, MPI_Comm *intercomm,
    int array_of_errcodes []);

int MPI_Comm_spawn_multiple (
    int count, char *array_of_commands [], char **array_of_argv [],
    const int array_of_maxprocs [], const MPI_Info array_of_info [],
    int root, MPI_Comm comm, MPI_Comm *intercomm,
    int array_of_errcodes [])

int MPI_Comm_get_parent (MPI_Comm *parent);

Configuration. A set of key value pairs used to provide additional configuration

int MPI_Info_create (MPI_Info *info);
int MPI_Info_free (MPI_Info *info);
int MPI_Info_dup (MPI_Info info, MPI_Info *newinfo);

int MPI_Info_set (MPI_Info info, const char *key, const char *value);
int MPI_Info_get_nkeys (MPI_Info info, int *nkeys);
int MPI_Info_get_nthkey (MPI_Info info, int n, char *key);
int MPI_Info_get_string (MPI_Info info, const char *key, int *buflen, char *value, int *flag);
int MPI_Info_delete (MPI_Info info, const char *key);