2004-07-14 18:11:03 +04:00
|
|
|
// -*- c++ -*-
|
|
|
|
//
|
2005-11-05 22:57:48 +03:00
|
|
|
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
// University Research and Technology
|
|
|
|
// Corporation. All rights reserved.
|
|
|
|
// Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
// of Tennessee Research Foundation. All rights
|
|
|
|
// reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
// University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
// Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
// All rights reserved.
|
2008-01-12 16:20:38 +03:00
|
|
|
// Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
// $COPYRIGHT$
|
|
|
|
//
|
|
|
|
// Additional copyrights may follow
|
|
|
|
//
|
2004-07-14 18:11:03 +04:00
|
|
|
// $HEADER$
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef MPIPP_H
|
|
|
|
#define MPIPP_H
|
|
|
|
|
|
|
|
//
|
|
|
|
// Let's ensure that we're really in C++, and some errant programmer
|
|
|
|
// hasn't included <mpicxx.h> just "for completeness"
|
|
|
|
//
|
|
|
|
|
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
|
2004-07-14 22:01:21 +04:00
|
|
|
// do not include ompi_config.h. it will smash free() as a symbol
|
2004-07-14 18:11:03 +04:00
|
|
|
#include <mpi.h>
|
|
|
|
|
|
|
|
// we include all this here so that we escape the silly namespacing issues
|
|
|
|
#include <map>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2007-08-19 01:35:51 +04:00
|
|
|
#if OMPI_PROVIDE_MPI_FILE_INTERFACE && !defined(OMPI_IGNORE_CXX_SEEK) & OMPI_WANT_MPI_CXX_SEEK
|
2006-10-16 18:20:31 +04:00
|
|
|
// We need to include the header files that define SEEK_* or use them
|
|
|
|
// in ways that require them to be #defines so that if the user
|
|
|
|
// includes them later, the double inclusion logic in the headers will
|
|
|
|
// prevent trouble from occuring.
|
|
|
|
|
2006-10-16 03:50:24 +04:00
|
|
|
// include so that we can smash SEEK_* properly
|
|
|
|
#include <stdio.h>
|
2006-10-16 18:20:31 +04:00
|
|
|
// include because on Linux, there is one place that assumes SEEK_* is
|
|
|
|
// a #define (it's used in an enum).
|
|
|
|
#include <iostream>
|
2006-10-16 03:50:24 +04:00
|
|
|
|
|
|
|
// smash SEEK_* #defines
|
|
|
|
#ifdef SEEK_SET
|
|
|
|
#undef SEEK_SET
|
|
|
|
#undef SEEK_CUR
|
|
|
|
#undef SEEK_END
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// make globally scoped constants to replace smashed #defines
|
|
|
|
extern const int SEEK_SET;
|
|
|
|
extern const int SEEK_CUR;
|
|
|
|
extern const int SEEK_END;
|
|
|
|
#endif
|
|
|
|
|
2004-07-14 18:11:03 +04:00
|
|
|
// forward declare so that we can still do inlining
|
2005-07-04 02:45:48 +04:00
|
|
|
struct opal_mutex_t;
|
2004-07-14 18:11:03 +04:00
|
|
|
|
2005-12-23 19:49:09 +03:00
|
|
|
// See lengthy explanation in intercepts.cc about this function.
|
2004-07-14 18:11:03 +04:00
|
|
|
extern "C" void
|
2004-09-23 12:41:20 +04:00
|
|
|
ompi_mpi_cxx_op_intercept(void *invec, void *outvec, int *len,
|
2005-12-23 19:49:09 +03:00
|
|
|
MPI_Datatype *datatype, MPI_User_function *fn);
|
2004-07-14 18:11:03 +04:00
|
|
|
|
|
|
|
extern "C" void
|
2008-02-10 22:29:25 +03:00
|
|
|
ompi_mpi_cxx_comm_errhandler_invoke(ompi_errhandler_t *c_errhandler,
|
|
|
|
MPI_Comm *mpi_comm, int *err,
|
|
|
|
const char *message);
|
2006-12-31 02:41:42 +03:00
|
|
|
extern "C" void
|
2008-02-10 22:29:25 +03:00
|
|
|
ompi_mpi_cxx_win_errhandler_invoke(ompi_errhandler_t *c_errhandler,
|
|
|
|
MPI_Win *mpi_comm, int *err,
|
|
|
|
const char *message);
|
2007-08-19 01:35:51 +04:00
|
|
|
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
|
2004-07-14 18:11:03 +04:00
|
|
|
extern "C" void
|
2008-02-10 22:29:25 +03:00
|
|
|
ompi_mpi_cxx_file_errhandler_invoke(ompi_errhandler_t *c_errhandler,
|
|
|
|
MPI_File *mpi_comm, int *err,
|
|
|
|
const char *message);
|
2007-08-19 01:35:51 +04:00
|
|
|
#endif
|
2004-07-14 18:11:03 +04:00
|
|
|
|
|
|
|
//used for attr intercept functions
|
|
|
|
enum CommType { eIntracomm, eIntercomm, eCartcomm, eGraphcomm};
|
|
|
|
|
|
|
|
extern "C" int
|
2006-12-31 02:41:42 +03:00
|
|
|
ompi_mpi_cxx_comm_copy_attr_intercept(MPI_Comm oldcomm, int keyval,
|
|
|
|
void *extra_state, void *attribute_val_in,
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
void *attribute_val_out, int *flag,
|
|
|
|
MPI_Comm newcomm);
|
2006-12-31 02:41:42 +03:00
|
|
|
extern "C" int
|
|
|
|
ompi_mpi_cxx_comm_delete_attr_intercept(MPI_Comm comm, int keyval,
|
|
|
|
void *attribute_val, void *extra_state);
|
2004-07-14 18:11:03 +04:00
|
|
|
|
|
|
|
extern "C" int
|
2006-12-31 02:41:42 +03:00
|
|
|
ompi_mpi_cxx_type_copy_attr_intercept(MPI_Datatype oldtype, int keyval,
|
|
|
|
void *extra_state, void *attribute_val_in,
|
|
|
|
void *attribute_val_out, int *flag);
|
|
|
|
extern "C" int
|
|
|
|
ompi_mpi_cxx_type_delete_attr_intercept(MPI_Datatype type, int keyval,
|
|
|
|
void *attribute_val, void *extra_state);
|
|
|
|
|
|
|
|
extern "C" int
|
|
|
|
ompi_mpi_cxx_win_copy_attr_intercept(MPI_Win oldwin, int keyval,
|
|
|
|
void *extra_state, void *attribute_val_in,
|
|
|
|
void *attribute_val_out, int *flag);
|
|
|
|
extern "C" int
|
|
|
|
ompi_mpi_cxx_win_delete_attr_intercept(MPI_Win win, int keyval,
|
|
|
|
void *attribute_val, void *extra_state);
|
|
|
|
|
|
|
|
|
2004-07-14 18:11:03 +04:00
|
|
|
|
2006-11-06 21:42:00 +03:00
|
|
|
//
|
|
|
|
// MPI generalized request intercepts
|
|
|
|
//
|
|
|
|
|
|
|
|
extern "C" int
|
|
|
|
ompi_mpi_cxx_grequest_query_fn_intercept(void *state, MPI_Status *status);
|
|
|
|
extern "C" int
|
|
|
|
ompi_mpi_cxx_grequest_free_fn_intercept(void *state);
|
|
|
|
extern "C" int
|
|
|
|
ompi_mpi_cxx_grequest_cancel_fn_intercept(void *state, int canceled);
|
|
|
|
|
2006-08-28 22:51:09 +04:00
|
|
|
/**
|
|
|
|
* Windows bool type is not any kind of integer. Special care should
|
|
|
|
* be taken in order to cast it correctly.
|
|
|
|
*/
|
|
|
|
#if defined(WIN32) || defined(_WIN32) || defined(WIN64)
|
|
|
|
#define OPAL_INT_TO_BOOL(VALUE) ((VALUE) != 0 ? true : false)
|
|
|
|
#else
|
|
|
|
#define OPAL_INT_TO_BOOL(VALUE) ((bool)(VALUE))
|
|
|
|
#endif /* defined(WIN32) || defined(_WIN32) || defined(WIN64) */
|
2004-07-14 18:11:03 +04:00
|
|
|
|
|
|
|
#if 0 /* OMPI_ENABLE_MPI_PROFILING */
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mpi/cxx/pmpicxx.h"
|
2004-07-14 18:11:03 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace MPI {
|
|
|
|
|
|
|
|
#if ! OMPI_HAVE_CXX_EXCEPTION_SUPPORT
|
2007-05-04 13:03:37 +04:00
|
|
|
extern int mpi_errno;
|
2004-07-14 18:11:03 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
class Comm_Null;
|
|
|
|
class Comm;
|
|
|
|
class Intracomm;
|
|
|
|
class Intercomm;
|
|
|
|
class Graphcomm;
|
|
|
|
class Cartcomm;
|
|
|
|
class Datatype;
|
|
|
|
class Errhandler;
|
|
|
|
class Group;
|
|
|
|
class Op;
|
|
|
|
class Request;
|
2006-10-24 00:17:30 +04:00
|
|
|
class Grequest;
|
2004-07-14 18:11:03 +04:00
|
|
|
class Status;
|
|
|
|
class Info;
|
|
|
|
class Win;
|
2007-08-19 01:35:51 +04:00
|
|
|
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
|
2004-07-14 18:11:03 +04:00
|
|
|
class File;
|
2007-08-19 01:35:51 +04:00
|
|
|
#endif
|
2004-07-14 18:11:03 +04:00
|
|
|
|
|
|
|
typedef MPI_Aint Aint;
|
|
|
|
typedef MPI_Offset Offset;
|
|
|
|
|
2007-06-06 20:25:18 +04:00
|
|
|
#ifdef OMPI_BUILDING_CXX_BINDINGS_LIBRARY
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mpi/cxx/constants.h"
|
|
|
|
#include "ompi/mpi/cxx/functions.h"
|
|
|
|
#include "ompi/mpi/cxx/datatype.h"
|
2007-06-06 20:25:18 +04:00
|
|
|
#else
|
|
|
|
#include "openmpi/ompi/mpi/cxx/constants.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/functions.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/datatype.h"
|
|
|
|
#endif
|
2004-07-14 18:11:03 +04:00
|
|
|
|
|
|
|
typedef void User_function(const void* invec, void* inoutvec, int len,
|
|
|
|
const Datatype& datatype);
|
|
|
|
|
2007-06-05 05:42:47 +04:00
|
|
|
/* Prevent needing a -I${prefix}/include/openmpi, as it seems to
|
|
|
|
really annoy peope that don't use the wrapper compilers and is
|
|
|
|
no longer worth the fight of getting right... */
|
|
|
|
#ifdef OMPI_BUILDING_CXX_BINDINGS_LIBRARY
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mpi/cxx/exception.h"
|
|
|
|
#include "ompi/mpi/cxx/op.h"
|
|
|
|
#include "ompi/mpi/cxx/status.h"
|
|
|
|
#include "ompi/mpi/cxx/request.h" //includes class Prequest
|
|
|
|
#include "ompi/mpi/cxx/group.h"
|
|
|
|
#include "ompi/mpi/cxx/comm.h"
|
2006-12-31 02:41:42 +03:00
|
|
|
#include "ompi/mpi/cxx/win.h"
|
2007-08-19 01:35:51 +04:00
|
|
|
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
|
2006-12-31 02:41:42 +03:00
|
|
|
#include "ompi/mpi/cxx/file.h"
|
2007-08-19 01:35:51 +04:00
|
|
|
#endif
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mpi/cxx/errhandler.h"
|
|
|
|
#include "ompi/mpi/cxx/intracomm.h"
|
|
|
|
#include "ompi/mpi/cxx/topology.h" //includes Cartcomm and Graphcomm
|
|
|
|
#include "ompi/mpi/cxx/intercomm.h"
|
|
|
|
#include "ompi/mpi/cxx/info.h"
|
2007-06-05 05:42:47 +04:00
|
|
|
#else
|
|
|
|
#include "openmpi/ompi/mpi/cxx/exception.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/op.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/status.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/request.h" //includes class Prequest
|
|
|
|
#include "openmpi/ompi/mpi/cxx/group.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/comm.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/win.h"
|
2007-08-19 01:35:51 +04:00
|
|
|
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
|
2007-06-05 05:42:47 +04:00
|
|
|
#include "openmpi/ompi/mpi/cxx/file.h"
|
2007-08-19 01:35:51 +04:00
|
|
|
#endif
|
2007-06-05 05:42:47 +04:00
|
|
|
#include "openmpi/ompi/mpi/cxx/errhandler.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/intracomm.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/topology.h" //includes Cartcomm and Graphcomm
|
|
|
|
#include "openmpi/ompi/mpi/cxx/intercomm.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/info.h"
|
|
|
|
#endif
|
2004-07-14 18:11:03 +04:00
|
|
|
|
2008-06-20 17:36:02 +04:00
|
|
|
// Version string
|
|
|
|
extern const char ompi_libcxx_version_string[];
|
2004-07-14 18:11:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0 /* OMPI_ENABLE_MPI_PROFILING */
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mpi/cxx/pop_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/pgroup_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/pstatus_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/prequest_inln.h"
|
2004-07-14 18:11:03 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// These are the "real" functions, whether prototyping is enabled
|
|
|
|
// or not. These functions are assigned to either the MPI::XXX class
|
|
|
|
// or the PMPI::XXX class based on the value of the macro MPI
|
|
|
|
// which is set in mpi2cxx_config.h.
|
|
|
|
// If prototyping is enabled, there is a top layer that calls these
|
|
|
|
// PMPI functions, and this top layer is in the XXX.cc files.
|
|
|
|
//
|
|
|
|
|
2007-06-05 05:42:47 +04:00
|
|
|
/* see note above... */
|
|
|
|
#ifdef OMPI_BUILDING_CXX_BINDINGS_LIBRARY
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mpi/cxx/datatype_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/functions_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/request_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/comm_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/intracomm_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/topology_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/intercomm_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/group_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/op_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/errhandler_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/status_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/info_inln.h"
|
|
|
|
#include "ompi/mpi/cxx/win_inln.h"
|
2007-08-19 01:35:51 +04:00
|
|
|
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mpi/cxx/file_inln.h"
|
2007-08-19 01:35:51 +04:00
|
|
|
#endif
|
2007-06-05 05:42:47 +04:00
|
|
|
#else
|
|
|
|
#include "openmpi/ompi/mpi/cxx/datatype_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/functions_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/request_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/comm_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/intracomm_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/topology_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/intercomm_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/group_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/op_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/errhandler_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/status_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/info_inln.h"
|
|
|
|
#include "openmpi/ompi/mpi/cxx/win_inln.h"
|
2007-08-19 01:35:51 +04:00
|
|
|
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
|
2007-06-05 05:42:47 +04:00
|
|
|
#include "openmpi/ompi/mpi/cxx/file_inln.h"
|
|
|
|
#endif
|
2007-08-19 01:35:51 +04:00
|
|
|
#endif
|
2004-07-14 18:11:03 +04:00
|
|
|
|
|
|
|
#endif // #if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
#endif // #ifndef MPIPP_H_
|