From cd6fd000dfc116d15d29bf9bbfe4831213b37fbf Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 30 Sep 2004 22:14:35 +0000 Subject: [PATCH] Oops -- I didn't check that *all* datatypes were added into the f_to_c table in my last commit. This commit fixes that, and then re-patches up mpif.h.in to match. I'm not sure that we need *all* of the datatypes in there (e.g., do we really need the C datatypes?), but since George isn't around, I followed the "when in doubt, it doesn't hurt to add more entries to the table" rule. Following up with a detailed message to George... This commit was SVN r2900. --- include/mpif.h.in | 27 +++++---- src/datatype/dt_module.c | 120 +++++++++++++++++++++++---------------- 2 files changed, 87 insertions(+), 60 deletions(-) diff --git a/include/mpif.h.in b/include/mpif.h.in index ced14536e3..d3d0874593 100644 --- a/include/mpif.h.in +++ b/include/mpif.h.in @@ -284,13 +284,15 @@ parameter (MPI_ERRORS_ARE_FATAL=1) parameter (MPI_ERRORS_RETURN=2) + integer MPI_BYTE, MPI_PACKED, MPI_UB, MPI_LB + integer MPI_CHARACTER, MPI_LOGICAL integer MPI_INTEGER, MPI_INTEGER1, MPI_INTEGER2, MPI_INTEGER4 - integer MPI_INTEGER8, MPI_REAL, MPI_REAL2, MPI_REAL4, MPI_REAL8 - integer MPI_REAL16, MPI_DOUBLE_PRECISION - integer MPI_COMPLEX, MPI_LOGICAL, MPI_CHARACTER - integer MPI_BYTE, MPI_PACKED, MPI_UB, MPI_LB, MPI_2REAL - integer MPI_2DOUBLE_PRECISION, MPI_2INTEGER + integer MPI_INTEGER8, MPI_INTEGER16 + integer MPI_REAL, MPI_REAL4, MPI_REAL8, MPI_REAL16 + integer MPI_DOUBLE_PRECISION + integer MPI_COMPLEX, MPI_COMPLEX8, MPI_COMPLEX16, MPI_COMPLEX32 integer MPI_DOUBLE_COMPLEX + integer MPI_2REAL, MPI_2DOUBLE_PRECISION, MPI_2INTEGER parameter (MPI_BYTE=1) parameter (MPI_PACKED=2) @@ -303,17 +305,20 @@ parameter (MPI_INTEGER2=9) parameter (MPI_INTEGER4=10) parameter (MPI_INTEGER8=11) - parameter (MPI_REAL=12) - parameter (MPI_REAL2=13) + parameter (MPI_INTEGER16=12) + parameter (MPI_REAL=13) parameter (MPI_REAL4=14) parameter (MPI_REAL8=15) parameter (MPI_REAL16=16) parameter (MPI_DOUBLE_PRECISION=17) parameter (MPI_COMPLEX=18) - parameter (MPI_DOUBLE_COMPLEX=19) - parameter (MPI_2REAL=20) - parameter (MPI_2DOUBLE_PRECISION=21) - parameter (MPI_2INTEGER=22) + parameter (MPI_COMPLEX8=19) + parameter (MPI_COMPLEX16=20) + parameter (MPI_COMPLEX32=21) + parameter (MPI_DOUBLE_COMPLEX=22) + parameter (MPI_2REAL=23) + parameter (MPI_2DOUBLE_PRECISION=24) + parameter (MPI_2INTEGER=25) integer MPI_MAX, MPI_MIN, MPI_SUM, MPI_PROD, MPI_LAND integer MPI_BAND, MPI_LOR, MPI_BOR, MPI_LXOR, MPI_BXOR diff --git a/src/datatype/dt_module.c b/src/datatype/dt_module.c index 9d0c554b44..f2278f0695 100644 --- a/src/datatype/dt_module.c +++ b/src/datatype/dt_module.c @@ -266,56 +266,78 @@ int ompi_ddt_init( void ) for( i = 0; i < DT_MAX_PREDEFINED; i++ ) local_sizes[i] = basicDatatypes[i]->size; - /* The order of the data registration should be the same as the one - * in the mpif.h file. Any modification here should be reflected there !!! - */ /* Start to populate the f2c index translation table */ - ompi_mpi_datatype_null.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_datatype_null ); - ompi_mpi_byte.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_byte ); - ompi_mpi_packed.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_packed ); - ompi_mpi_ub.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_ub ); - ompi_mpi_lb.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_lb ); - ompi_mpi_character.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_character ); - ompi_mpi_logic.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_logic ); - ompi_mpi_integer.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_integer ); - ompi_mpi_char.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_char ); - ompi_mpi_short.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_short ); - ompi_mpi_int.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_int ); - ompi_mpi_long_long.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_long_long ); - ompi_mpi_real.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_real ); - ompi_mpi_real.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_real ); - ompi_mpi_real.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_real ); - ompi_mpi_double.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_double ); - ompi_mpi_long_double.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_long_double ); - ompi_mpi_dblprec.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_dblprec ); - ompi_mpi_cplex.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_cplex ); - ompi_mpi_dblcplex.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_dblcplex ); - ompi_mpi_2real.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_2real ); - ompi_mpi_2dblcplex.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_2dblcplex ); - ompi_mpi_2integer.d_f_to_c_index = - ompi_pointer_array_add( ompi_datatype_f_to_c_table, &ompi_mpi_2integer ); + + /* The order of the data registration should be the same as the + * one in the mpif.h file. Any modification here should be + * reflected there !!! Do the Fortran types first so that mpif.h + * can have consecutive, dense numbers. */ + + /* This macro makes everything significantly easier to read below. + All hail the moog! :-) */ + +#define MOOG(name) ompi_mpi_##name.d_f_to_c_index = \ + ompi_pointer_array_add(ompi_datatype_f_to_c_table, &ompi_mpi_##name); + + MOOG(datatype_null); + MOOG(byte); + MOOG(packed); + MOOG(ub); + MOOG(lb); + MOOG(character); + MOOG(logic); + MOOG(integer); + MOOG(integer1); + MOOG(integer2); + MOOG(integer4); + MOOG(integer8); + MOOG(integer16); + MOOG(real); + MOOG(real4); + MOOG(real8); + MOOG(real16); + MOOG(dblprec); + MOOG(cplex); + MOOG(complex8); + MOOG(complex16); + MOOG(complex32); + MOOG(dblcplex); + MOOG(2real); + MOOG(2dblcplex); + MOOG(2integer); + + /* Now the C types */ + + MOOG(wchar); + MOOG(char); + MOOG(unsigned_char); + MOOG(short); + MOOG(unsigned_short); + MOOG(int); + MOOG(unsigned); + MOOG(long); + MOOG(unsigned_long); + MOOG(long_long); + MOOG(long_long_int); + MOOG(unsigned_long_long); + + MOOG(float); + MOOG(double); + MOOG(long_double); + + MOOG(float_int); + MOOG(double_int); + MOOG(longdbl_int); + MOOG(long_int); + MOOG(2int); + MOOG(short_int); + + /* C++ types */ + + MOOG(cxx_bool); + MOOG(cxx_cplex); + MOOG(cxx_dblcplex); + MOOG(cxx_ldblcplex); return OMPI_SUCCESS; }