From 512b24affb626b9d44c72c029ec46d70c475d82b Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 15 Feb 2008 22:54:20 +0000 Subject: [PATCH] Add support for all optional Fortran logical types (MPI_LOGICAL1, MPI_LOGICAL2, MPI_LOGICAL4 and MPI_LOGICAL8). This commit close the ticket #331. This commit was SVN r17473. --- NEWS | 3 ++ configure.ac | 12 ++++++ ompi/datatype/dt_module.c | 82 ++++++++++++++++++++++++++++++++++++--- ompi/include/mpi.h.in | 24 ++++++++++++ 4 files changed, 116 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index c6bb0808b8..a479bf7b91 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,9 @@ version 1.0. Trunk (not on release branches yet) ----------------------------------- +-Add support for some optional Fortran datatypes (MPI_LOGICAL1, MPI_LOGICAL2, + MPI_LOGICAL4 and MPI_LOGICAL8) + -Convert the C++ Comm, Datatype and Winn keyval creation and intercept callbacks to *not* use the STL as well as removing the STL use from the error handler routines. This was removing the STL from the C++ bindings (Solaris has 2 diff --git a/configure.ac b/configure.ac index 87ec1d2546..605d4e4ded 100644 --- a/configure.ac +++ b/configure.ac @@ -423,6 +423,14 @@ AC_DEFINE([ompi_fortran_bogus_type_t], [int], OMPI_F77_CHECK([LOGICAL], [yes], [char, int32_t, int, int64_t, long long, long], [-1]) +OMPI_F77_CHECK([LOGICAL*1], [yes], + [char, int8_t, short, int32_t, int, int64_t, long long, long], [1]) +OMPI_F77_CHECK([LOGICAL*2], [yes], + [short, int16_t, int32_t, int, int64_t, long long, long], [2]) +OMPI_F77_CHECK([LOGICAL*4], [yes], + [int32_t, int, int64_t, long long, long], [4]) +OMPI_F77_CHECK([LOGICAL*8], [yes], + [int, int64_t, long long, long], [8]) OMPI_F77_CHECK([INTEGER], [yes], [int32_t, int, int64_t, long long, long], [-1]) OMPI_F77_CHECK([INTEGER*1], [no], @@ -520,6 +528,10 @@ OMPI_F90_CKINDS="" # LOGICAL and friends OMPI_F90_CHECK([LOGICAL]) +OMPI_F90_CHECK([LOGICAL*1], [1]) +OMPI_F90_CHECK([LOGICAL*2], [2]) +OMPI_F90_CHECK([LOGICAL*4], [4]) +OMPI_F90_CHECK([LOGICAL*8], [8]) # INTEGER and friends OMPI_F90_CHECK([INTEGER]) diff --git a/ompi/datatype/dt_module.c b/ompi/datatype/dt_module.c index 110e2e2eda..b0d58f435f 100644 --- a/ompi/datatype/dt_module.c +++ b/ompi/datatype/dt_module.c @@ -171,6 +171,27 @@ OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2cplex = INIT_BASIC_TYPE( DT_2COMPLEX, 2C OMPI_DECLSPEC ompi_datatype_t ompi_mpi_2dblcplex = INIT_BASIC_TYPE( DT_2DOUBLE_COMPLEX, 2DOUBLE_COMPLEX ); OMPI_DECLSPEC ompi_datatype_t ompi_mpi_unavailable = INIT_UNAVAILABLE_DATA( UNAVAILABLE ); +#if OMPI_HAVE_FORTRAN_LOGICAL1 +OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logical1 = INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGICAL1, OMPI_SIZEOF_FORTRAN_LOGICAL1, OMPI_ALIGNMENT_FORTRAN_LOGICAL1, 0 ); +#else +OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logical1 = INIT_UNAVAILABLE_DATA( LOGICAL1 ); +#endif /* OMPI_HAVE_FORTRAN_LOGICAL1 */ +#if OMPI_HAVE_FORTRAN_LOGICAL2 +OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logical2 = INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGICAL2, OMPI_SIZEOF_FORTRAN_LOGICAL2, OMPI_ALIGNMENT_FORTRAN_LOGICAL2, 0 ); +#else +OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logical2 = INIT_UNAVAILABLE_DATA( LOGICAL2 ); +#endif /* OMPI_HAVE_FORTRAN_LOGICAL2 */ +#if OMPI_HAVE_FORTRAN_LOGICAL4 +OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logical4 = INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGICAL4, OMPI_SIZEOF_FORTRAN_LOGICAL4, OMPI_ALIGNMENT_FORTRAN_LOGICAL4, 0 ); +#else +OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logical4 = INIT_UNAVAILABLE_DATA( LOGICAL4 ); +#endif /* OMPI_HAVE_FORTRAN_LOGICAL4 */ +#if OMPI_HAVE_FORTRAN_LOGICAL8 +OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logical8 = INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGICAL8, OMPI_SIZEOF_FORTRAN_LOGICAL8, OMPI_ALIGNMENT_FORTRAN_LOGICAL8, 0 ); +#else +OMPI_DECLSPEC ompi_datatype_t ompi_mpi_logical8 = INIT_UNAVAILABLE_DATA( LOGICAL8 ); +#endif /* OMPI_HAVE_FORTRAN_LOGICAL8 */ + #if OMPI_HAVE_FORTRAN_REAL2 OMPI_DECLSPEC ompi_datatype_t ompi_mpi_real2 = INIT_BASIC_FORTRAN_TYPE( DT_FLOAT, REAL2, OMPI_SIZEOF_FORTRAN_REAL2, OMPI_ALIGNMENT_FORTRAN_REAL2, DT_FLAG_DATA_FLOAT ); #else @@ -496,6 +517,57 @@ int32_t ompi_ddt_init( void ) ompi_mpi_cxx_ldblcplex.flags |= DT_FLAG_DATA_CPP | DT_FLAG_DATA_COMPLEX; #endif /* HAVE_LONG_DOUBLE */ + /* Optional Fortran LOGICAL types */ +#if OMPI_HAVE_FORTRAN_LOGICAL1 +#if (OMPI_SIZEOF_FORTRAN_LOGICAL1 == SIZEOF_CHAR) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical1, "MPI_LOGICAL1", &ompi_mpi_char ); +#elif (OMPI_SIZEOF_FORTRAN_LOGICAL1 == SIZEOF_SHORT) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical1, "MPI_LOGICAL1", &ompi_mpi_short ); +#elif (OMPI_SIZEOF_FORTRAN_LOGICAL1 == SIZEOF_INT) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical1, "MPI_LOGICAL1", &ompi_mpi_int ); +#else +# warning "No proper C type found for LOGICAL1" + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical1, "MPI_LOGICAL1", &ompi_mpi_unavailable ); +#endif + ompi_mpi_logical1.flags |= DT_FLAG_DATA_FORTRAN; +#endif /* OMPI_HAVE_FORTRAN_LOGICAL1 */ + +#if OMPI_HAVE_FORTRAN_LOGICAL2 +#if (OMPI_SIZEOF_FORTRAN_LOGICAL2 == SIZEOF_SHORT) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical2, "MPI_LOGICAL2", &ompi_mpi_short ); +#elif (OMPI_SIZEOF_FORTRAN_LOGICAL2 == SIZEOF_INT) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical2, "MPI_LOGICAL2", &ompi_mpi_int ); +#else +# warning "No proper C type found for LOGICAL2" + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical2, "MPI_LOGICAL2", &ompi_mpi_unavailable ); +#endif + ompi_mpi_logical2.flags |= DT_FLAG_DATA_FORTRAN; +#endif /* OMPI_HAVE_FORTRAN_LOGICAL2 */ + +#if OMPI_HAVE_FORTRAN_LOGICAL4 +#if (OMPI_SIZEOF_FORTRAN_LOGICAL4 == SIZEOF_INT) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical4, "MPI_LOGICAL4", &ompi_mpi_int ); +#elif (OMPI_SIZEOF_FORTRAN_LOGICAL4 == SIZEOF_LONG) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical4, "MPI_LOGICAL4", &ompi_mpi_long ); +#else +# warning "No proper C type found for LOGICAL4" + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical4, "MPI_LOGICAL4", &ompi_mpi_unavailable ); +#endif + ompi_mpi_logical4.flags |= DT_FLAG_DATA_FORTRAN; +#endif /* OMPI_HAVE_FORTRAN_LOGICAL4 */ + +#if OMPI_HAVE_FORTRAN_LOGICAL8 +#if (OMPI_SIZEOF_FORTRAN_LOGICAL8 == SIZEOF_LONG) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical8, "MPI_LOGICAL8", &ompi_mpi_long ); +#elif (OMPI_SIZEOF_FORTRAN_LOGICAL8 == SIZEOF_LONG_LONG) + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical8, "MPI_LOGICAL8", &ompi_mpi_long_long_int ); +#else +# warning "No proper C type found for LOGICAL8" + DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_logical8, "MPI_LOGICAL8", &ompi_mpi_unavailable ); +#endif + ompi_mpi_logical8.flags |= DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_INT; +#endif /* OMPI_HAVE_FORTRAN_INTEGER8 */ + /* Optional Fortran REAL types */ #if OMPI_HAVE_FORTRAN_REAL2 @@ -648,12 +720,12 @@ int32_t ompi_ddt_init( void ) /* This macro makes everything significantly easier to read below. All hail the moog! :-) */ -#define MOOG(name) \ - { \ - ompi_mpi_##name.d_f_to_c_index = \ - opal_pointer_array_add(&ompi_datatype_f_to_c_table, &ompi_mpi_##name); \ +#define MOOG(name) \ + { \ + ompi_mpi_##name.d_f_to_c_index = \ + opal_pointer_array_add(&ompi_datatype_f_to_c_table, &ompi_mpi_##name); \ if( ompi_ddt_number_of_predefined_data < (ompi_mpi_##name).d_f_to_c_index ) \ - ompi_ddt_number_of_predefined_data = (ompi_mpi_##name).d_f_to_c_index; \ + ompi_ddt_number_of_predefined_data = (ompi_mpi_##name).d_f_to_c_index; \ } /* diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 035abefc2b..3459dc6037 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -628,6 +628,18 @@ OMPI_DECLSPEC extern struct ompi_datatype_t ompi_mpi_cxx_ldblcplex; OMPI_DECLSPEC extern struct ompi_datatype_t ompi_mpi_cxx_bool; OMPI_DECLSPEC extern struct ompi_datatype_t ompi_mpi_2cplex, ompi_mpi_2dblcplex; /* other MPI2 datatypes */ +#if OMPI_HAVE_FORTRAN_LOGICAL1 +OMPI_DECLSPEC extern struct ompi_datatype_t ompi_mpi_logical1; +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL2 +OMPI_DECLSPEC extern struct ompi_datatype_t ompi_mpi_logical2; +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL4 +OMPI_DECLSPEC extern struct ompi_datatype_t ompi_mpi_logical4; +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL8 +OMPI_DECLSPEC extern struct ompi_datatype_t ompi_mpi_logical8; +#endif #if OMPI_HAVE_FORTRAN_INTEGER1 OMPI_DECLSPEC extern struct ompi_datatype_t ompi_mpi_integer1; #endif @@ -735,6 +747,18 @@ OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE; /* Fortran datatype bindings */ #define MPI_CHARACTER (&ompi_mpi_character) #define MPI_LOGICAL (&ompi_mpi_logic) +#if OMPI_HAVE_FORTRAN_LOGICAL1 +#define MPI_LOGICAL1 (&ompi_mpi_logical1) +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL2 +#define MPI_LOGICAL2 (&ompi_mpi_logical2) +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL4 +#define MPI_LOGICAL4 (&ompi_mpi_logical4) +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL8 +#define MPI_LOGICAL8 (&ompi_mpi_logical8) +#endif #define MPI_INTEGER (&ompi_mpi_integer) #if OMPI_HAVE_FORTRAN_INTEGER1 #define MPI_INTEGER1 (&ompi_mpi_integer1)