[mpich2-dev] [PATCH 1/2] Issue 4920: Rename and Move MPI_Pint and Related MPI_Aint Casting Macros
Jeff Parker
jjparker at us.ibm.com
Fri May 16 07:24:49 CDT 2008
For the "MPI_Aint 32-bit platform" work, we created MPI_Pint and MPI_Puint to
be a numeric type (int) that is the size of a pointer and exposed them in
mpi.h. We also added to mpi.h several configurable #defines to assist with
casting between pointers and MPI_Aints. To avoid mpi.h namespace pollution,
Bill Gropp suggested the following:
"Use MPIR_Pint and MPIR_Puint instead of MPI_Pint and MPI_Puint. Â
Put the definitions for AINT and PINT/PUINT into a new file, mpirdefs.h.in,
that configure will use to create mpirdefs.h ; this file should be included
by mpiutil.h ."
These two patches implement Bill Gropp's suggestion. They are intended to be
applied together and on top of the already-submitted "MPI_Aint on 32-bit
platform" patches.
Note that the MPI_AINT_FMT_DEC_SPEC and MPI_AINT_FMT_HEX_SPEC #defines that
were in MPICH2 1.0.7 remain in mpi.h because
1. We used them in the MPICH test suite to print MPI_Aint values
2. Other users of MPICH could have already started using them.
The first patch (1 of 2) in this file contains the core changes to implement this.
The second patch (2 of 2) in a separate file contains the uninteresting changes
caused by the naming changes.
Here is the detail of the changes:
In mpich2/configure.in:
Change MPI_PINT to MPIR_PINT
Change MPI_PUINT to MPIR_PUINT
Change MPI_Pint to MPIR_Pint
Change MPI_Puint to MPIR_Puint
Change MPI_AINT_CAST_TO_VOID_PTR to MPIR_MPI_AINT_CAST_TO_VOID_PTR
Change MPI_VOID_PTR_CAST_TO_MPI_AINT to MPIR_VOID_PTR_CAST_TO_MPI_AINT
Change MPI_PTR_DISP_CAST_TO_MPI_AINT to MPIR_PTR_DISP_CAST_TO_MPI_AINT
Change MPI_AINT_CAST_TO_LONG_LONG to MPIR_MPI_AINT_CAST_TO_LONG_LONG
In mpich2/src/include:
Create mpirdefs.h.in which will create mpirdefs.h during configure.
Move definitions from mpich2/src/include/mpi.h.in to
mpich2/src/include/mpirdefs.h:
#define MPIR_MPI_AINT_CAST_TO_VOID_PTR @MPIR_MPI_AINT_CAST_TO_VOID_PTR@
#define MPIR_VOID_PTR_CAST_TO_MPI_AINT @MPIR_VOID_PTR_CAST_TO_MPI_AINT@
#define MPIR_PTR_DISP_CAST_TO_MPI_AINT @MPIR_PTR_DISP_CAST_TO_MPI_AINT@
#define MPIR_MPI_AINT_CAST_TO_LONG_LONG @MPIR_MPI_AINT_CAST_TO_LONG_LONG@
typedef @MPIR_PINT@ MPIR_Pint;
typedef @MPIR_PUINT@ MPIR_Puint;
Do NOT move the following definitions out of mpi.h.in. We use them in the
testcases, and other customers of MPICH2 1.0.7 could have as well:
#define MPI_AINT_FMT_DEC_SPEC "@MPI_AINT_FMT_DEC_SPEC@"
#define MPI_AINT_FMT_HEX_SPEC "@MPI_AINT_FMT_HEX_SPEC@"
In mpich2/src/include/mpiimpl.h,
mpich2/src/binding/f77/mpi_fortimpl.h
mpich2/src/include/mpishared.h
mpich2/src/mpid/common/sock/mpidu_sock.h :
Include mpirdefs.h
Change the references to
MPI_Puint,
MPI_Pint,
MPI_AINT_CAST_TO_VOID_PTR,
MPI_VOID_PTR_CAST_TO_MPI_AINT,
MPI_PTR_DISP_CAST_TO_MPI_AINT,
MPI_AINT_CAST_TO_LONG_LONG
to the new names. These changes are in patch 2 of 2.
Signed-off-by: Jeff Parker <jjparker at us.ibm.com>
---
mpich2/configure.in | 33 +++++++++++++++--------------
mpich2/src/binding/f77/mpi_fortimpl.h | 1 +
mpich2/src/include/mpi.h.in | 6 -----
mpich2/src/include/mpiimpl.h | 3 ++
mpich2/src/include/mpirdefs.h.in | 31 ++++++++++++++++++++++++++++
mpich2/src/include/mpishared.h | 3 ++
mpich2/src/include/mpiutil.h | 2 +-
mpich2/src/mpid/common/sock/mpidu_sock.h | 1 +
8 files changed, 57 insertions(+), 23 deletions(-)
create mode 100644 mpich2/src/include/mpirdefs.h.in
diff --git a/mpich2/configure.in b/mpich2/configure.in
index 18f3938..74bc610 100755
--- a/mpich2/configure.in
+++ b/mpich2/configure.in
@@ -4998,28 +4998,28 @@ for type in int long long_long short ; do
fi
done
# Set signed and unsigned pointer type
-MPI_PINT=$MPI_AINT
-MPI_PUINT="unsigned $MPI_AINT"
-AC_SUBST(MPI_PINT)
-AC_SUBST(MPI_PUINT)
+MPIR_PINT=$MPI_AINT
+MPIR_PUINT="unsigned $MPI_AINT"
+AC_SUBST(MPIR_PINT)
+AC_SUBST(MPIR_PUINT)
# Set:
# - MPI_AINT cast to a void*
-MPI_AINT_CAST_TO_VOID_PTR="(void*)(MPI_Pint)"
+MPIR_MPI_AINT_CAST_TO_VOID_PTR="(void*)(MPIR_Pint)"
# - void* cast to an MPI_AINT
-MPI_VOID_PTR_CAST_TO_MPI_AINT="(MPI_Aint)(MPI_Puint)"
+MPIR_VOID_PTR_CAST_TO_MPI_AINT="(MPI_Aint)(MPIR_Puint)"
# - void* containing a signed displacement cast to an MPI_AINT
-MPI_PTR_DISP_CAST_TO_MPI_AINT="(MPI_Aint)(MPI_Pint)"
+MPIR_PTR_DISP_CAST_TO_MPI_AINT="(MPI_Aint)(MPIR_Pint)"
# - MPI_AINT cast to a long long for printing
-MPI_AINT_CAST_TO_LONG_LONG="(long long)"
-export MPI_AINT_CAST_TO_VOID_PTR
-export MPI_VOID_PTR_CAST_TO_MPI_AINT
-export MPI_PTR_DISP_CAST_TO_MPI_AINT
-export MPI_AINT_CAST_TO_LONG_LONG
-AC_SUBST(MPI_AINT_CAST_TO_VOID_PTR)
-AC_SUBST(MPI_VOID_PTR_CAST_TO_MPI_AINT)
-AC_SUBST(MPI_PTR_DISP_CAST_TO_MPI_AINT)
-AC_SUBST(MPI_AINT_CAST_TO_LONG_LONG)
+MPIR_MPI_AINT_CAST_TO_LONG_LONG="(long long)"
+export MPIR_MPI_AINT_CAST_TO_VOID_PTR
+export MPIR_VOID_PTR_CAST_TO_MPI_AINT
+export MPIR_PTR_DISP_CAST_TO_MPI_AINT
+export MPIR_MPI_AINT_CAST_TO_LONG_LONG
+AC_SUBST(MPIR_MPI_AINT_CAST_TO_VOID_PTR)
+AC_SUBST(MPIR_VOID_PTR_CAST_TO_MPI_AINT)
+AC_SUBST(MPIR_PTR_DISP_CAST_TO_MPI_AINT)
+AC_SUBST(MPIR_MPI_AINT_CAST_TO_LONG_LONG)
if test "$with_aint_size" == "0" ; then
# use default size
@@ -5910,6 +5910,7 @@ AC_OUTPUT(Makefile src/Makefile src/include/Makefile \
src/util/dbg/getfuncstack \
src/util/osserv/Makefile \
src/include/mpi.h \
+ src/include/mpirdefs.h \
test/Makefile test/util/Makefile \
test/util/timer/Makefile \
test/basic/Makefile \
diff --git a/mpich2/src/binding/f77/mpi_fortimpl.h b/mpich2/src/binding/f77/mpi_fortimpl.h
index 72ca8ee..870f37a 100644
--- a/mpich2/src/binding/f77/mpi_fortimpl.h
+++ b/mpich2/src/binding/f77/mpi_fortimpl.h
@@ -5,6 +5,7 @@
* See COPYRIGHT in top-level directory.
*/
#include "mpichconf.h"
+#include "mpirdefs.h"
/* Handle different mechanisms for passing Fortran CHARACTER to routines */
#ifdef USE_FORT_MIXED_STR_LEN
diff --git a/mpich2/src/include/mpi.h.in b/mpich2/src/include/mpi.h.in
index d623a5e..3bb30cf 100644
--- a/mpich2/src/include/mpi.h.in
+++ b/mpich2/src/include/mpi.h.in
@@ -329,15 +329,9 @@ typedef int MPI_Info;
/* Definitions that are determined by configure. */
typedef @MPI_AINT@ MPI_Aint;
-typedef @MPI_PINT@ MPI_Pint;
-typedef @MPI_PUINT@ MPI_Puint;
typedef @MPI_FINT@ MPI_Fint;
#define MPI_AINT_FMT_DEC_SPEC "@MPI_AINT_FMT_DEC_SPEC@"
#define MPI_AINT_FMT_HEX_SPEC "@MPI_AINT_FMT_HEX_SPEC@"
-#define MPI_AINT_CAST_TO_VOID_PTR @MPI_AINT_CAST_TO_VOID_PTR@
-#define MPI_VOID_PTR_CAST_TO_MPI_AINT @MPI_VOID_PTR_CAST_TO_MPI_AINT@
-#define MPI_PTR_DISP_CAST_TO_MPI_AINT @MPI_PTR_DISP_CAST_TO_MPI_AINT@
-#define MPI_AINT_CAST_TO_LONG_LONG @MPI_AINT_CAST_TO_LONG_LONG@
/* Let ROMIO know that MPI_Offset is already defined */
#define HAVE_MPI_OFFSET
diff --git a/mpich2/src/include/mpiimpl.h b/mpich2/src/include/mpiimpl.h
index 9218580..e55c20e 100644
--- a/mpich2/src/include/mpiimpl.h
+++ b/mpich2/src/include/mpiimpl.h
@@ -21,6 +21,9 @@
/* Include nested mpi (NMPI) definitions */
#include "nmpi.h"
+/* Include internal definitions */
+#include "mpirdefs.h"
+
/* There are a few definitions that must be made *before* the mpichconf.h
file is included. These include the definitions of the error levels */
#define MPICH_ERROR_MSG_NONE 0
diff --git a/mpich2/src/include/mpirdefs.h.in b/mpich2/src/include/mpirdefs.h.in
new file mode 100644
index 0000000..3de9749
--- /dev/null
+++ b/mpich2/src/include/mpirdefs.h.in
@@ -0,0 +1,31 @@
+/* (C)Copyright IBM Corp. 2008, 2008 */
+/**
+ * \file include/mpirdefs.h
+ * \brief Internal Configurable Definitions
+ */
+
+/* @configure_input@ */
+
+#ifndef MPIRDEFS_INCLUDED
+#define MPIRDEFS_INCLUDED
+
+/* Internal definitions for MPI implementations */
+
+/* Keep C++ compilers from getting confused */
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* Definitions that are determined by configure. */
+typedef @MPIR_PINT@ MPIR_Pint;
+typedef @MPIR_PUINT@ MPIR_Puint;
+#define MPIR_MPI_AINT_CAST_TO_VOID_PTR @MPIR_MPI_AINT_CAST_TO_VOID_PTR@
+#define MPIR_VOID_PTR_CAST_TO_MPI_AINT @MPIR_VOID_PTR_CAST_TO_MPI_AINT@
+#define MPIR_PTR_DISP_CAST_TO_MPI_AINT @MPIR_PTR_DISP_CAST_TO_MPI_AINT@
+#define MPIR_MPI_AINT_CAST_TO_LONG_LONG @MPIR_MPI_AINT_CAST_TO_LONG_LONG@
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/mpich2/src/include/mpishared.h b/mpich2/src/include/mpishared.h
index 27aada3..26f510e 100644
--- a/mpich2/src/include/mpishared.h
+++ b/mpich2/src/include/mpishared.h
@@ -22,6 +22,9 @@
#include "mpichconf.h"
#endif
+/* Internal definitions */
+#include "mpirdefs.h"
+
/* The most common MPI error classes */
#ifndef MPI_SUCCESS
#define MPI_SUCCESS 0
diff --git a/mpich2/src/include/mpiutil.h b/mpich2/src/include/mpiutil.h
index bb9e550..b74323c 100644
--- a/mpich2/src/include/mpiutil.h
+++ b/mpich2/src/include/mpiutil.h
@@ -105,6 +105,6 @@ int MPID_Abort( struct MPID_Comm *comm, int mpi_errno, int exit_code, const char
* \param[in] aint Variable of type MPI_Aint
*/
#define MPID_Ensure_Aint_fits_in_pointer( aint ) \
- MPIU_Assert( (aint) == (MPI_Aint)(MPI_Puint) MPI_AINT_CAST_TO_VOID_PTR (aint) );
+ MPIU_Assert( (aint) == (MPI_Aint)(MPIR_Puint) MPIR_MPI_AINT_CAST_TO_VOID_PTR (aint) );
#endif /* !defined(MPIUTIL_H_INCLUDED) */
diff --git a/mpich2/src/mpid/common/sock/mpidu_sock.h b/mpich2/src/mpid/common/sock/mpidu_sock.h
index 80477be..f43b335 100644
--- a/mpich2/src/mpid/common/sock/mpidu_sock.h
+++ b/mpich2/src/mpid/common/sock/mpidu_sock.h
@@ -23,6 +23,7 @@ CPLUSPLUS_BEGIN
#include "mpidu_sock_conf.h"
/* Load just the utility definitions that we need */
#include "mpibase.h"
+#include "mpirdefs.h"
#include "mpiutil.h"
#include "mpitypedefs.h"
--
1.5.3.7
More information about the mpich2-dev
mailing list