OpenMPI  0.1.1
mpiruntime.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2008 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * Copyright (c) 2006-2011 Cisco Systems, Inc. All rights reserved.
13  * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
14  * reserved.
15  * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
16  * Copyright (c) 2009 University of Houston. All rights reserved.
17  * $COPYRIGHT$
18  *
19  * Additional copyrights may follow
20  *
21  * $HEADER$
22  */
23 
24 /**
25  * @file
26  *
27  * Interface into the MPI portion of the Open MPI Run Time Environment
28  */
29 
30 #ifndef OMPI_MPI_MPIRUNTIME_H
31 #define OMPI_MPI_MPIRUNTIME_H
32 
33 #include "ompi_config.h"
34 
35 #include "opal/class/opal_list.h"
37 
38 BEGIN_C_DECLS
39 
40 /** forward type declaration */
41 struct ompi_communicator_t;
42 /** forward type declaration */
43 struct opal_thread_t;
44 
45 /* Global variables and symbols for the MPI layer */
46 
47 /** Did mpi start to initialize? */
48 OMPI_DECLSPEC extern bool ompi_mpi_init_started;
49 /** Is mpi initialized? */
50 OMPI_DECLSPEC extern bool ompi_mpi_initialized;
51 /** Has mpi been finalized? */
52 OMPI_DECLSPEC extern bool ompi_mpi_finalized;
53 
54 /** Do we have multiple threads? */
55 OMPI_DECLSPEC extern bool ompi_mpi_thread_multiple;
56 /** Thread level requested to \c MPI_Init_thread() */
57 OMPI_DECLSPEC extern int ompi_mpi_thread_requested;
58 /** Thread level provided by Open MPI */
59 OMPI_DECLSPEC extern int ompi_mpi_thread_provided;
60 /** Identifier of the main thread */
61 OMPI_DECLSPEC extern struct opal_thread_t *ompi_mpi_main_thread;
62 
63 
64 /** Bitflags to be used for the modex exchange for the various thread
65  * levels. Required to support heterogeneous environments */
66 #define OMPI_THREADLEVEL_SINGLE_BF 0x00000001
67 #define OMPI_THREADLEVEL_FUNNELED_BF 0x00000002
68 #define OMPI_THREADLEVEL_SERIALIZED_BF 0x00000004
69 #define OMPI_THREADLEVEL_MULTIPLE_BF 0x00000008
70 
71 #define OMPI_THREADLEVEL_SET_BITFLAG(threadlevelin,threadlevelout) { \
72  if ( MPI_THREAD_SINGLE == threadlevelin ) { \
73  threadlevelout |= OMPI_THREADLEVEL_SINGLE_BF; \
74  } else if ( MPI_THREAD_FUNNELED == threadlevelin ) { \
75  threadlevelout |= OMPI_THREADLEVEL_FUNNELED_BF; \
76  } else if ( MPI_THREAD_SERIALIZED == threadlevelin ) { \
77  threadlevelout |= OMPI_THREADLEVEL_SERIALIZED_BF; \
78  } else if ( MPI_THREAD_MULTIPLE == threadlevelin ) { \
79  threadlevelout |= OMPI_THREADLEVEL_MULTIPLE_BF; \
80  }}
81 
82 
83 #define OMPI_THREADLEVEL_IS_MULTIPLE(threadlevel) (threadlevel & OMPI_THREADLEVEL_MULTIPLE_BF)
84 
85 /** Do we want to be warned on fork or not? */
86 OMPI_DECLSPEC extern bool ompi_warn_on_fork;
87 
88 /** In ompi_mpi_init: a list of all memory associated with calling
89  MPI_REGISTER_DATAREP so that we can free it during
90  MPI_FINALIZE. */
91 OMPI_DECLSPEC extern opal_list_t ompi_registered_datareps;
92 
93 /** In ompi_mpi_init: the lists of Fortran 90 mathing datatypes.
94  * We need these lists and hashtables in order to satisfy the new
95  * requirements introduced in MPI 2-1 Sect. 10.2.5,
96  * MPI_TYPE_CREATE_F90_xxxx, page 295, line 47.
97  */
99 extern opal_hash_table_t ompi_mpi_f90_real_hashtable;
100 extern opal_hash_table_t ompi_mpi_f90_complex_hashtable;
101 
102 /** version string of ompi */
103 OMPI_DECLSPEC extern const char ompi_version_string[];
104 
105 OMPI_DECLSPEC void ompi_warn_fork(void);
106 
107 /**
108  * Initialize the Open MPI MPI environment
109  *
110  * @param argc argc, typically from main() (IN)
111  * @param argv argv, typically from main() (IN)
112  * @param requested Thread support that is requested (IN)
113  * @param provided Thread support that is provided (OUT)
114  *
115  * @returns MPI_SUCCESS if successful
116  * @returns Error code if unsuccessful
117  *
118  * Intialize all support code needed for MPI applications. This
119  * function should only be called by MPI applications (including
120  * singletons). If this function is called, ompi_init() and
121  * ompi_rte_init() should *not* be called.
122  *
123  * It is permissable to pass in (0, NULL) for (argc, argv).
124  */
125 int ompi_mpi_init(int argc, char **argv, int requested, int *provided);
126 
127 /**
128  * Finalize the Open MPI MPI environment
129  *
130  * @returns MPI_SUCCESS if successful
131  * @returns Error code if unsuccessful
132  *
133  * Should be called after all MPI functionality is complete (usually
134  * during MPI_FINALIZE).
135  */
136 int ompi_mpi_finalize(void);
137 
138 /**
139  * Abort the processes of comm
140  */
141 OMPI_DECLSPEC int ompi_mpi_abort(struct ompi_communicator_t* comm,
142  int errcode, bool kill_remote_of_intercomm);
143 
144 /**
145  * Do a preconnect of MPI connections (i.e., force connections to
146  * be made if they will be made).
147  */
148 int ompi_init_preconnect_mpi(void);
149 
150 END_C_DECLS
151 
152 #endif /* OMPI_MPI_MPIRUNTIME_H */
opal_hash_table_t ompi_mpi_f90_integer_hashtable
In ompi_mpi_init: the lists of Fortran 90 mathing datatypes.
Definition: ompi_mpi_init.c:269
Definition: opal_hash_table.h:42
OMPI_DECLSPEC int ompi_mpi_thread_provided
Thread level provided by Open MPI.
Definition: ompi_mpi_init.c:128
OMPI_DECLSPEC bool ompi_mpi_finalized
Has mpi been finalized?
Definition: ompi_mpi_init.c:124
OMPI_DECLSPEC bool ompi_mpi_thread_multiple
Do we have multiple threads?
Definition: ompi_mpi_init.c:126
The opal_list_t interface is used to provide a generic doubly-linked list container for Open MPI...
OMPI_DECLSPEC bool ompi_warn_on_fork
Do we want to be warned on fork or not?
Definition: ompi_mpi_init.c:134
OMPI_DECLSPEC bool ompi_mpi_init_started
Did mpi start to initialize?
Definition: ompi_mpi_init.c:122
int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
Initialize the Open MPI MPI environment.
Definition: ompi_mpi_init.c:283
int ompi_mpi_finalize(void)
Finalize the Open MPI MPI environment.
Definition: ompi_mpi_finalize.c:91
OMPI_DECLSPEC opal_list_t ompi_registered_datareps
In ompi_mpi_init: a list of all memory associated with calling MPI_REGISTER_DATAREP so that we can fr...
Definition: ompi_mpi_init.c:280
OMPI_DECLSPEC bool ompi_mpi_initialized
Is mpi initialized?
Definition: ompi_mpi_init.c:123
OMPI_DECLSPEC int ompi_mpi_abort(struct ompi_communicator_t *comm, int errcode, bool kill_remote_of_intercomm)
Abort the processes of comm.
Definition: ompi_mpi_abort.c:52
A hash table that may be indexed with either fixed length (e.g.
OMPI_DECLSPEC int ompi_mpi_thread_requested
Thread level requested to MPI_Init_thread()
Definition: ompi_mpi_init.c:127
OMPI_DECLSPEC const char ompi_version_string[]
version string of ompi
Definition: ompi_mpi_init.c:116
Definition: opal_list.h:147
int ompi_init_preconnect_mpi(void)
Do a preconnect of MPI connections (i.e., force connections to be made if they will be made)...
Definition: ompi_mpi_preconnect.c:28
Definition: threads.h:46
OMPI_DECLSPEC struct opal_thread_t * ompi_mpi_main_thread
Identifier of the main thread.
Definition: ompi_mpi_init.c:130
Definition: communicator.h:118