[97] | 1 | // -*- c++ -*- |
---|
| 2 | // |
---|
| 3 | // Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana |
---|
| 4 | // University Research and Technology |
---|
| 5 | // Corporation. All rights reserved. |
---|
| 6 | // Copyright (c) 2004-2005 The University of Tennessee and The University |
---|
| 7 | // of Tennessee Research Foundation. All rights |
---|
| 8 | // reserved. |
---|
| 9 | // Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, |
---|
| 10 | // University of Stuttgart. All rights reserved. |
---|
| 11 | // Copyright (c) 2004-2005 The Regents of the University of California. |
---|
| 12 | // All rights reserved. |
---|
| 13 | // Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. |
---|
| 14 | // Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. |
---|
| 15 | // $COPYRIGHT$ |
---|
| 16 | // |
---|
| 17 | // Additional copyrights may follow |
---|
| 18 | // |
---|
| 19 | // $HEADER$ |
---|
| 20 | // |
---|
| 21 | |
---|
| 22 | #ifndef MPIPP_H |
---|
| 23 | #define MPIPP_H |
---|
| 24 | |
---|
| 25 | // |
---|
| 26 | // Let's ensure that we're really in C++, and some errant programmer |
---|
| 27 | // hasn't included <mpicxx.h> just "for completeness" |
---|
| 28 | // |
---|
| 29 | |
---|
| 30 | #if defined(__cplusplus) || defined(c_plusplus) |
---|
| 31 | |
---|
| 32 | // do not include ompi_config.h. it will smash free() as a symbol |
---|
| 33 | #include <mpi.h> |
---|
| 34 | |
---|
| 35 | // we include all this here so that we escape the silly namespacing issues |
---|
| 36 | #include <map> |
---|
| 37 | #include <utility> |
---|
| 38 | |
---|
| 39 | #include <stdarg.h> |
---|
| 40 | |
---|
| 41 | #if OMPI_PROVIDE_MPI_FILE_INTERFACE && !defined(OMPI_IGNORE_CXX_SEEK) & OMPI_WANT_MPI_CXX_SEEK |
---|
| 42 | // We need to include the header files that define SEEK_* or use them |
---|
| 43 | // in ways that require them to be #defines so that if the user |
---|
| 44 | // includes them later, the double inclusion logic in the headers will |
---|
| 45 | // prevent trouble from occuring. |
---|
| 46 | |
---|
| 47 | // include so that we can smash SEEK_* properly |
---|
| 48 | #include <stdio.h> |
---|
| 49 | // include because on Linux, there is one place that assumes SEEK_* is |
---|
| 50 | // a #define (it's used in an enum). |
---|
| 51 | #include <iostream> |
---|
| 52 | |
---|
| 53 | static const int ompi_stdio_seek_set = SEEK_SET; |
---|
| 54 | static const int ompi_stdio_seek_cur = SEEK_CUR; |
---|
| 55 | static const int ompi_stdio_seek_end = SEEK_END; |
---|
| 56 | |
---|
| 57 | // smash SEEK_* #defines |
---|
| 58 | #ifdef SEEK_SET |
---|
| 59 | #undef SEEK_SET |
---|
| 60 | #undef SEEK_CUR |
---|
| 61 | #undef SEEK_END |
---|
| 62 | #endif |
---|
| 63 | |
---|
| 64 | // make globally scoped constants to replace smashed #defines |
---|
| 65 | static const int SEEK_SET = ompi_stdio_seek_set; |
---|
| 66 | static const int SEEK_CUR = ompi_stdio_seek_cur; |
---|
| 67 | static const int SEEK_END = ompi_stdio_seek_end; |
---|
| 68 | #endif |
---|
| 69 | |
---|
| 70 | #ifdef OMPI_HAVE_SYS_SYNCH_H |
---|
| 71 | // Solaris threads.h pulls in sys/synch.h which in certain versions |
---|
| 72 | // defines LOCK_SHARED. |
---|
| 73 | |
---|
| 74 | // include so that we can smash LOCK_SHARED |
---|
| 75 | #include <sys/synch.h> |
---|
| 76 | |
---|
| 77 | // a user app may be included on a system with an older version |
---|
| 78 | // sys/synch.h |
---|
| 79 | #ifdef LOCK_SHARED |
---|
| 80 | static const int ompi_synch_lock_shared = LOCK_SHARED; |
---|
| 81 | |
---|
| 82 | // smash LOCK_SHARED #defines |
---|
| 83 | #undef LOCK_SHARED |
---|
| 84 | |
---|
| 85 | // make globally scoped constants to replace smashed #defines |
---|
| 86 | static const int LOCK_SHARED = ompi_synch_lock_shared; |
---|
| 87 | #endif |
---|
| 88 | #endif |
---|
| 89 | |
---|
| 90 | // forward declare so that we can still do inlining |
---|
| 91 | struct opal_mutex_t; |
---|
| 92 | |
---|
| 93 | // See lengthy explanation in intercepts.cc about this function. |
---|
| 94 | extern "C" void |
---|
| 95 | ompi_mpi_cxx_op_intercept(void *invec, void *outvec, int *len, |
---|
| 96 | MPI_Datatype *datatype, MPI_User_function *fn); |
---|
| 97 | |
---|
| 98 | extern "C" void |
---|
| 99 | ompi_mpi_cxx_comm_errhandler_invoke(ompi_errhandler_t *c_errhandler, |
---|
| 100 | MPI_Comm *mpi_comm, int *err, |
---|
| 101 | const char *message); |
---|
| 102 | extern "C" void |
---|
| 103 | ompi_mpi_cxx_win_errhandler_invoke(ompi_errhandler_t *c_errhandler, |
---|
| 104 | MPI_Win *mpi_comm, int *err, |
---|
| 105 | const char *message); |
---|
| 106 | #if OMPI_PROVIDE_MPI_FILE_INTERFACE |
---|
| 107 | extern "C" void |
---|
| 108 | ompi_mpi_cxx_file_errhandler_invoke(ompi_errhandler_t *c_errhandler, |
---|
| 109 | MPI_File *mpi_comm, int *err, |
---|
| 110 | const char *message); |
---|
| 111 | #endif |
---|
| 112 | |
---|
| 113 | //used for attr intercept functions |
---|
| 114 | enum CommType { eIntracomm, eIntercomm, eCartcomm, eGraphcomm}; |
---|
| 115 | |
---|
| 116 | extern "C" int |
---|
| 117 | ompi_mpi_cxx_comm_copy_attr_intercept(MPI_Comm oldcomm, int keyval, |
---|
| 118 | void *extra_state, void *attribute_val_in, |
---|
| 119 | void *attribute_val_out, int *flag, |
---|
| 120 | MPI_Comm newcomm); |
---|
| 121 | extern "C" int |
---|
| 122 | ompi_mpi_cxx_comm_delete_attr_intercept(MPI_Comm comm, int keyval, |
---|
| 123 | void *attribute_val, void *extra_state); |
---|
| 124 | |
---|
| 125 | extern "C" int |
---|
| 126 | ompi_mpi_cxx_type_copy_attr_intercept(MPI_Datatype oldtype, int keyval, |
---|
| 127 | void *extra_state, void *attribute_val_in, |
---|
| 128 | void *attribute_val_out, int *flag); |
---|
| 129 | extern "C" int |
---|
| 130 | ompi_mpi_cxx_type_delete_attr_intercept(MPI_Datatype type, int keyval, |
---|
| 131 | void *attribute_val, void *extra_state); |
---|
| 132 | |
---|
| 133 | extern "C" int |
---|
| 134 | ompi_mpi_cxx_win_copy_attr_intercept(MPI_Win oldwin, int keyval, |
---|
| 135 | void *extra_state, void *attribute_val_in, |
---|
| 136 | void *attribute_val_out, int *flag); |
---|
| 137 | extern "C" int |
---|
| 138 | ompi_mpi_cxx_win_delete_attr_intercept(MPI_Win win, int keyval, |
---|
| 139 | void *attribute_val, void *extra_state); |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | // |
---|
| 144 | // MPI generalized request intercepts |
---|
| 145 | // |
---|
| 146 | |
---|
| 147 | extern "C" int |
---|
| 148 | ompi_mpi_cxx_grequest_query_fn_intercept(void *state, MPI_Status *status); |
---|
| 149 | extern "C" int |
---|
| 150 | ompi_mpi_cxx_grequest_free_fn_intercept(void *state); |
---|
| 151 | extern "C" int |
---|
| 152 | ompi_mpi_cxx_grequest_cancel_fn_intercept(void *state, int canceled); |
---|
| 153 | |
---|
| 154 | /** |
---|
| 155 | * Windows bool type is not any kind of integer. Special care should |
---|
| 156 | * be taken in order to cast it correctly. |
---|
| 157 | */ |
---|
| 158 | #if defined(WIN32) || defined(_WIN32) || defined(WIN64) |
---|
| 159 | #define OPAL_INT_TO_BOOL(VALUE) ((VALUE) != 0 ? true : false) |
---|
| 160 | #else |
---|
| 161 | #define OPAL_INT_TO_BOOL(VALUE) ((bool)(VALUE)) |
---|
| 162 | #endif /* defined(WIN32) || defined(_WIN32) || defined(WIN64) */ |
---|
| 163 | |
---|
| 164 | #if 0 /* OMPI_ENABLE_MPI_PROFILING */ |
---|
| 165 | #include "ompi/mpi/cxx/pmpicxx.h" |
---|
| 166 | #endif |
---|
| 167 | |
---|
| 168 | namespace MPI { |
---|
| 169 | |
---|
| 170 | #if ! OMPI_HAVE_CXX_EXCEPTION_SUPPORT |
---|
| 171 | extern int mpi_errno; |
---|
| 172 | #endif |
---|
| 173 | |
---|
| 174 | class Comm_Null; |
---|
| 175 | class Comm; |
---|
| 176 | class Intracomm; |
---|
| 177 | class Intercomm; |
---|
| 178 | class Graphcomm; |
---|
| 179 | class Cartcomm; |
---|
| 180 | class Datatype; |
---|
| 181 | class Errhandler; |
---|
| 182 | class Group; |
---|
| 183 | class Op; |
---|
| 184 | class Request; |
---|
| 185 | class Grequest; |
---|
| 186 | class Status; |
---|
| 187 | class Info; |
---|
| 188 | class Win; |
---|
| 189 | #if OMPI_PROVIDE_MPI_FILE_INTERFACE |
---|
| 190 | class File; |
---|
| 191 | #endif |
---|
| 192 | |
---|
| 193 | typedef MPI_Aint Aint; |
---|
| 194 | typedef MPI_Offset Offset; |
---|
| 195 | |
---|
| 196 | #ifdef OMPI_BUILDING_CXX_BINDINGS_LIBRARY |
---|
| 197 | #include "ompi/mpi/cxx/constants.h" |
---|
| 198 | #include "ompi/mpi/cxx/functions.h" |
---|
| 199 | #include "ompi/mpi/cxx/datatype.h" |
---|
| 200 | #else |
---|
| 201 | #include "openmpi/ompi/mpi/cxx/constants.h" |
---|
| 202 | #include "openmpi/ompi/mpi/cxx/functions.h" |
---|
| 203 | #include "openmpi/ompi/mpi/cxx/datatype.h" |
---|
| 204 | #endif |
---|
| 205 | |
---|
| 206 | typedef void User_function(const void* invec, void* inoutvec, int len, |
---|
| 207 | const Datatype& datatype); |
---|
| 208 | |
---|
| 209 | /* Prevent needing a -I${prefix}/include/openmpi, as it seems to |
---|
| 210 | really annoy peope that don't use the wrapper compilers and is |
---|
| 211 | no longer worth the fight of getting right... */ |
---|
| 212 | #ifdef OMPI_BUILDING_CXX_BINDINGS_LIBRARY |
---|
| 213 | #include "ompi/mpi/cxx/exception.h" |
---|
| 214 | #include "ompi/mpi/cxx/op.h" |
---|
| 215 | #include "ompi/mpi/cxx/status.h" |
---|
| 216 | #include "ompi/mpi/cxx/request.h" //includes class Prequest |
---|
| 217 | #include "ompi/mpi/cxx/group.h" |
---|
| 218 | #include "ompi/mpi/cxx/comm.h" |
---|
| 219 | #include "ompi/mpi/cxx/win.h" |
---|
| 220 | #if OMPI_PROVIDE_MPI_FILE_INTERFACE |
---|
| 221 | #include "ompi/mpi/cxx/file.h" |
---|
| 222 | #endif |
---|
| 223 | #include "ompi/mpi/cxx/errhandler.h" |
---|
| 224 | #include "ompi/mpi/cxx/intracomm.h" |
---|
| 225 | #include "ompi/mpi/cxx/topology.h" //includes Cartcomm and Graphcomm |
---|
| 226 | #include "ompi/mpi/cxx/intercomm.h" |
---|
| 227 | #include "ompi/mpi/cxx/info.h" |
---|
| 228 | #else |
---|
| 229 | #include "openmpi/ompi/mpi/cxx/exception.h" |
---|
| 230 | #include "openmpi/ompi/mpi/cxx/op.h" |
---|
| 231 | #include "openmpi/ompi/mpi/cxx/status.h" |
---|
| 232 | #include "openmpi/ompi/mpi/cxx/request.h" //includes class Prequest |
---|
| 233 | #include "openmpi/ompi/mpi/cxx/group.h" |
---|
| 234 | #include "openmpi/ompi/mpi/cxx/comm.h" |
---|
| 235 | #include "openmpi/ompi/mpi/cxx/win.h" |
---|
| 236 | #if OMPI_PROVIDE_MPI_FILE_INTERFACE |
---|
| 237 | #include "openmpi/ompi/mpi/cxx/file.h" |
---|
| 238 | #endif |
---|
| 239 | #include "openmpi/ompi/mpi/cxx/errhandler.h" |
---|
| 240 | #include "openmpi/ompi/mpi/cxx/intracomm.h" |
---|
| 241 | #include "openmpi/ompi/mpi/cxx/topology.h" //includes Cartcomm and Graphcomm |
---|
| 242 | #include "openmpi/ompi/mpi/cxx/intercomm.h" |
---|
| 243 | #include "openmpi/ompi/mpi/cxx/info.h" |
---|
| 244 | #endif |
---|
| 245 | |
---|
| 246 | // Version string |
---|
| 247 | extern const char ompi_libcxx_version_string[]; |
---|
| 248 | } |
---|
| 249 | |
---|
| 250 | #if 0 /* OMPI_ENABLE_MPI_PROFILING */ |
---|
| 251 | #include "ompi/mpi/cxx/pop_inln.h" |
---|
| 252 | #include "ompi/mpi/cxx/pgroup_inln.h" |
---|
| 253 | #include "ompi/mpi/cxx/pstatus_inln.h" |
---|
| 254 | #include "ompi/mpi/cxx/prequest_inln.h" |
---|
| 255 | #endif |
---|
| 256 | |
---|
| 257 | // |
---|
| 258 | // These are the "real" functions, whether prototyping is enabled |
---|
| 259 | // or not. These functions are assigned to either the MPI::XXX class |
---|
| 260 | // or the PMPI::XXX class based on the value of the macro MPI |
---|
| 261 | // which is set in mpi2cxx_config.h. |
---|
| 262 | // If prototyping is enabled, there is a top layer that calls these |
---|
| 263 | // PMPI functions, and this top layer is in the XXX.cc files. |
---|
| 264 | // |
---|
| 265 | |
---|
| 266 | /* see note above... */ |
---|
| 267 | #ifdef OMPI_BUILDING_CXX_BINDINGS_LIBRARY |
---|
| 268 | #include "ompi/mpi/cxx/datatype_inln.h" |
---|
| 269 | #include "ompi/mpi/cxx/functions_inln.h" |
---|
| 270 | #include "ompi/mpi/cxx/request_inln.h" |
---|
| 271 | #include "ompi/mpi/cxx/comm_inln.h" |
---|
| 272 | #include "ompi/mpi/cxx/intracomm_inln.h" |
---|
| 273 | #include "ompi/mpi/cxx/topology_inln.h" |
---|
| 274 | #include "ompi/mpi/cxx/intercomm_inln.h" |
---|
| 275 | #include "ompi/mpi/cxx/group_inln.h" |
---|
| 276 | #include "ompi/mpi/cxx/op_inln.h" |
---|
| 277 | #include "ompi/mpi/cxx/errhandler_inln.h" |
---|
| 278 | #include "ompi/mpi/cxx/status_inln.h" |
---|
| 279 | #include "ompi/mpi/cxx/info_inln.h" |
---|
| 280 | #include "ompi/mpi/cxx/win_inln.h" |
---|
| 281 | #if OMPI_PROVIDE_MPI_FILE_INTERFACE |
---|
| 282 | #include "ompi/mpi/cxx/file_inln.h" |
---|
| 283 | #endif |
---|
| 284 | #else |
---|
| 285 | #include "openmpi/ompi/mpi/cxx/datatype_inln.h" |
---|
| 286 | #include "openmpi/ompi/mpi/cxx/functions_inln.h" |
---|
| 287 | #include "openmpi/ompi/mpi/cxx/request_inln.h" |
---|
| 288 | #include "openmpi/ompi/mpi/cxx/comm_inln.h" |
---|
| 289 | #include "openmpi/ompi/mpi/cxx/intracomm_inln.h" |
---|
| 290 | #include "openmpi/ompi/mpi/cxx/topology_inln.h" |
---|
| 291 | #include "openmpi/ompi/mpi/cxx/intercomm_inln.h" |
---|
| 292 | #include "openmpi/ompi/mpi/cxx/group_inln.h" |
---|
| 293 | #include "openmpi/ompi/mpi/cxx/op_inln.h" |
---|
| 294 | #include "openmpi/ompi/mpi/cxx/errhandler_inln.h" |
---|
| 295 | #include "openmpi/ompi/mpi/cxx/status_inln.h" |
---|
| 296 | #include "openmpi/ompi/mpi/cxx/info_inln.h" |
---|
| 297 | #include "openmpi/ompi/mpi/cxx/win_inln.h" |
---|
| 298 | #if OMPI_PROVIDE_MPI_FILE_INTERFACE |
---|
| 299 | #include "openmpi/ompi/mpi/cxx/file_inln.h" |
---|
| 300 | #endif |
---|
| 301 | #endif |
---|
| 302 | |
---|
| 303 | #endif // #if defined(__cplusplus) || defined(c_plusplus) |
---|
| 304 | #endif // #ifndef MPIPP_H_ |
---|