Refs trac:1603:
* Add OMPI_F77_CHECK_REAL16_C_EQUV test whether REAL*16 is bit equivalent to long double. AC_DEFINE OMPI_REAL16_MATCHES_C with result (0 or 1). * Update ompi_info to only show real16 support if OMPI_REAL16_MATCHES_C is 1. * Update DDT to only support REAL16 and COMPLEX32 if 1==OMPI_REAL16_MATCHES_C. * MPI Op function pointer tabls will have NULL for the REAL16 and COMPLEX32 entries if 0==OMPI_REAL16_MATCHES_C. * Slightly cleaned up OMPI_F77_GET_ALIGNMENT and OMPI_F77_CHECK m4 tests (use OMPI_VAR_SCOPE_PUSH/POP). This commit was SVN r19948. The following Trac tickets were found above: Ticket 1603 --> https://svn.open-mpi.org/trac/ompi/ticket/1603
Этот коммит содержится в:
родитель
aafa318248
Коммит
4f028171a2
@ -30,6 +30,8 @@ dnl
|
||||
#
|
||||
# types to search is a comma-seperated list of values
|
||||
AC_DEFUN([OMPI_F77_CHECK], [
|
||||
OMPI_VAR_SCOPE_PUSH([ofc_have_type ofc_type_size ofc_type_alignment ofc_c_type ofc_expected_size])
|
||||
|
||||
ofc_expected_size=$4
|
||||
ofc_have_type=0
|
||||
ofc_type_size=$ac_cv_sizeof_int
|
||||
@ -108,6 +110,5 @@ AC_DEFUN([OMPI_F77_CHECK], [
|
||||
[OMPI_ALIGNMENT_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_])[=$ofc_type_alignment]
|
||||
|
||||
# Clean up
|
||||
unset ofc_have_type ofc_type_size ofc_type_alignment ofc_c_type
|
||||
unset ofc_expected_size
|
||||
OMPI_VAR_SCOPE_POP
|
||||
])dnl
|
||||
|
106
config/f77_check_real16_c_equiv.m4
Обычный файл
106
config/f77_check_real16_c_equiv.m4
Обычный файл
@ -0,0 +1,106 @@
|
||||
dnl -*- shell-script -*-
|
||||
dnl
|
||||
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
dnl University Research and Technology
|
||||
dnl Corporation. All rights reserved.
|
||||
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
dnl of Tennessee Research Foundation. All rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
dnl University of Stuttgart. All rights reserved.
|
||||
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
dnl All rights reserved.
|
||||
dnl Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
dnl Additional copyrights may follow
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
|
||||
# OMPI_F77_CHECK_REAL16_C_EQUIV
|
||||
# ----------------------------------------------------
|
||||
AC_DEFUN([OMPI_F77_CHECK_REAL16_C_EQUIV],[
|
||||
unset happy
|
||||
OMPI_VAR_SCOPE_PUSH([happy define_value msg])
|
||||
AS_VAR_PUSHDEF([real16_matches_c_var], [ompi_cv_real16_c_equiv])
|
||||
|
||||
msg="in C"
|
||||
AS_IF([test "$OMPI_WANT_F77_BINDINGS" = "1"],
|
||||
[AS_IF([test "$OMPI_HAVE_FORTRAN_REAL16" = "1"],
|
||||
[msg="of $OMPI_FORTRAN_REAL16_C_TYPE"])])
|
||||
AC_CACHE_CHECK([if REAL*16 matches bit representation $msg],
|
||||
real16_matches_c_var,
|
||||
[AS_IF([test "$OMPI_WANT_F77_BINDINGS" = "1" -a "$OMPI_HAVE_FORTRAN_REAL16" = "1"],[
|
||||
# Make a C function of the Right name
|
||||
OMPI_F77_MAKE_C_FUNCTION([ompi_ac_c_fn], [c])
|
||||
|
||||
# C module
|
||||
cat > conftest_c.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void $ompi_ac_c_fn($OMPI_FORTRAN_REAL16_C_TYPE *a) {
|
||||
FILE *fp = fopen("conftestval", "w");
|
||||
if (NULL == fp) exit(1);
|
||||
fprintf(fp, "%s\n", (1.1L == *a) ? "yes" : "no");
|
||||
fclose(fp);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
EOF
|
||||
|
||||
# Fortran module
|
||||
cat > conftest_f.f <<EOF
|
||||
program bogus
|
||||
REAL*16 :: foo
|
||||
foo = 1.1
|
||||
call c(foo)
|
||||
end program bogus
|
||||
EOF
|
||||
rm -f conftestval
|
||||
# Compile and link
|
||||
OMPI_LOG_COMMAND([$CC $CFLAGS -I. -c conftest_c.c],
|
||||
[OMPI_LOG_COMMAND([$F77 $FFLAGS conftest_f.f conftest_c.o -o conftest $LDFLAGS $LIBS],
|
||||
[happy="yes"], [happy="no"])], [happy="no"])
|
||||
AS_IF([test "$happy" = "no"],
|
||||
[AC_MSG_RESULT([Error!])
|
||||
AC_MSG_ERROR([Could not determine if REAL*16 bit-matches C type])])
|
||||
|
||||
# If it worked so far, try running to see what we get
|
||||
AS_IF([test "$cross_compiling" = "yes"],
|
||||
[AC_MSG_RESULT([Error!])
|
||||
AC_MSG_ERROR([Can not determine if REAL*16 bit-matches C if cross compiling])],
|
||||
[OMPI_LOG_COMMAND([./conftest],
|
||||
[AS_VAR_SET(real16_matches_c_var, [`cat conftestval`])],
|
||||
[AC_MSG_RESULT([Error!])
|
||||
AC_MSG_ERROR([Could not determine if REAL*16 bit-matches C type])
|
||||
])
|
||||
])
|
||||
|
||||
# All done; whack tmp files
|
||||
rm -rf conftest*
|
||||
],[
|
||||
# No fortran bindings or no REAL*16
|
||||
AS_IF([test "$OMPI_WANT_F77_BINDINGS" = "0"],
|
||||
[msg="no (no Fortran bindings)"],
|
||||
[msg="no (no REAL*16)"])
|
||||
AS_VAR_SET(real16_matches_c_var, [$msg])
|
||||
])
|
||||
])
|
||||
|
||||
ompi_real16_matches_c=AS_VAR_GET([real16_matches_c_var])
|
||||
AS_VAR_POPDEF([real16_matches_c_var])
|
||||
|
||||
AS_IF([test "$ompi_real16_matches_c" = "yes"],
|
||||
[define_value=1],
|
||||
[define_value=0
|
||||
AC_MSG_WARN([MPI_REAL16 and MPI_COMPLEX32 support have been disabled])])
|
||||
AC_DEFINE_UNQUOTED([OMPI_REAL16_MATCHES_C], [$define_value],
|
||||
[Whether Fortran REAL*16 matches the bit format of the equivalent C type])
|
||||
OMPI_VAR_SCOPE_POP
|
||||
])
|
@ -20,6 +20,8 @@ dnl
|
||||
# OMPI_F77_GET_ALIGNMENT(type, shell variable to set)
|
||||
# ----------------------------------------------------
|
||||
AC_DEFUN([OMPI_F77_GET_ALIGNMENT],[
|
||||
unset happy
|
||||
OMPI_VAR_SCOPE_PUSH([happy ompi_conftest_h])
|
||||
AS_VAR_PUSHDEF([type_var], [ompi_cv_f77_alignment_$1])
|
||||
|
||||
AC_CACHE_CHECK([alignment of Fortran $1], type_var,
|
||||
@ -44,7 +46,7 @@ EOF
|
||||
cat > conftest.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
$conftest
|
||||
$ompi_conftest_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -75,18 +77,20 @@ EOF
|
||||
[happy="yes"], [happy="no"])], [happy="no"])
|
||||
|
||||
if test "$happy" = "no" ; then
|
||||
AC_MSG_RESULT([Error!])
|
||||
AC_MSG_ERROR([Could not determine alignment of $1])
|
||||
fi
|
||||
|
||||
AS_IF([test "$cross_compiling" = "yes"],
|
||||
[AC_MSG_ERROR([Can not determine alignment of $1 when cross-compiling])],
|
||||
[AC_MSG_RESULT([Error!])
|
||||
AC_MSG_ERROR([Can not determine alignment of $1 when cross-compiling])],
|
||||
[OMPI_LOG_COMMAND([./conftest],
|
||||
[AS_VAR_SET(type_var, [`cat conftestval`])],
|
||||
[AC_MSG_ERROR([Could not determine alignment of $1])])])
|
||||
|
||||
unset happy ompi_conf
|
||||
[AC_MSG_RESULT([Error!])
|
||||
AC_MSG_ERROR([Could not determine alignment of $1])])])
|
||||
rm -rf conftest*])
|
||||
|
||||
$2=AS_VAR_GET([type_var])
|
||||
AS_VAR_POPDEF([type_var])dnl
|
||||
OMPI_VAR_SCOPE_POP
|
||||
])
|
||||
|
@ -462,6 +462,12 @@ OMPI_F77_CHECK([REAL*8], [no],
|
||||
[float, double, long double], [8])
|
||||
OMPI_F77_CHECK([REAL*16], [no],
|
||||
[float, double, long double], [16])
|
||||
|
||||
# In some compilers, the bit representation of REAL*16 is not the same
|
||||
# as the C counterpart that we found. If this is the case, then we
|
||||
# want to disable reduction support for MPI_REAL16 (per ticket #1603).
|
||||
OMPI_F77_CHECK_REAL16_C_EQUIV
|
||||
|
||||
OMPI_F77_CHECK([DOUBLE PRECISION], [yes],
|
||||
[float, double, long double], [-1])
|
||||
|
||||
|
@ -211,7 +211,7 @@ OMPI_DECLSPEC ompi_datatype_t ompi_mpi_real8 = INIT_BASIC_FORTRAN_TYPE( DT_DOUBL
|
||||
#else
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_real8 = INIT_UNAVAILABLE_DATA( REAL8 );
|
||||
#endif
|
||||
#if OMPI_HAVE_FORTRAN_REAL16
|
||||
#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_REAL16_MATCHES_C
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_real16 = INIT_BASIC_FORTRAN_TYPE( DT_LONG_DOUBLE, REAL16, OMPI_SIZEOF_FORTRAN_REAL16, OMPI_ALIGNMENT_FORTRAN_REAL16, DT_FLAG_DATA_FLOAT );
|
||||
#else
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_real16 = INIT_UNAVAILABLE_DATA( REAL16 );
|
||||
@ -253,7 +253,7 @@ OMPI_DECLSPEC ompi_datatype_t ompi_mpi_complex16 = INIT_BASIC_FORTRAN_TYPE( DT_C
|
||||
#else
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_complex16 = INIT_UNAVAILABLE_DATA( COMPLEX16 );
|
||||
#endif
|
||||
#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_HAVE_FORTRAN_COMPLEX32
|
||||
#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_HAVE_FORTRAN_COMPLEX32 && OMPI_REAL16_MATCHES_C
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_complex32 = INIT_BASIC_FORTRAN_TYPE( DT_COMPLEX_LONG_DOUBLE, COMPLEX32, OMPI_SIZEOF_FORTRAN_COMPLEX32, OMPI_ALIGNMENT_FORTRAN_COMPLEX32, DT_FLAG_DATA_COMPLEX );
|
||||
#else
|
||||
OMPI_DECLSPEC ompi_datatype_t ompi_mpi_complex32 = INIT_UNAVAILABLE_DATA( COMPLEX32 );
|
||||
@ -705,7 +705,7 @@ int32_t ompi_ddt_init( void )
|
||||
#endif /* OMPI_HAVE_FORTRAN_COMPLEX16 */
|
||||
|
||||
#if OMPI_HAVE_FORTRAN_COMPLEX32
|
||||
#if (OMPI_SIZEOF_FORTRAN_COMPLEX32 == 2*SIZEOF_LONG_DOUBLE)
|
||||
#if OMPI_REAL16_MATCHES_C && (OMPI_SIZEOF_FORTRAN_COMPLEX32 == 2*SIZEOF_LONG_DOUBLE)
|
||||
DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_complex32, "MPI_COMPLEX32", &ompi_mpi_ldblcplex );
|
||||
#else
|
||||
# warning "No proper C type found for COMPLEX32"
|
||||
|
17
ompi/op/op.c
17
ompi/op/op.c
@ -234,7 +234,13 @@ OBJ_CLASS_INSTANCE(ompi_op_t, opal_object_t,
|
||||
#define FLOATING_POINT_FORTRAN_REAL8(name) { NULL }
|
||||
#define FLOATING_POINT_FORTRAN_REAL8_3BUFF(name) { NULL }
|
||||
#endif
|
||||
#if OMPI_HAVE_FORTRAN_REAL16
|
||||
/* If:
|
||||
- we have fortran REAL*16, *and*
|
||||
- fortran REAL*16 matches the bit representation of the
|
||||
corresponding C type
|
||||
Only then do we put in function pointers for REAL*16 reductions.
|
||||
Otherwise, just put in NULL. */
|
||||
#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_REAL16_MATCHES_C
|
||||
#define FLOATING_POINT_FORTRAN_REAL16(name) { ompi_mpi_op_##name##_fortran_real16 }
|
||||
#define FLOATING_POINT_FORTRAN_REAL16_3BUFF(name) { ompi_mpi_op_three_buff_##name##_fortran_real16 }
|
||||
#else
|
||||
@ -362,7 +368,14 @@ OBJ_CLASS_INSTANCE(ompi_op_t, opal_object_t,
|
||||
#define COMPLEX16(name) { NULL }
|
||||
#define COMPLEX16_3BUFF(name) { NULL }
|
||||
#endif
|
||||
#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_HAVE_FORTRAN_COMPLEX32
|
||||
/* If:
|
||||
- we have fortran REAL*16, *and*
|
||||
- fortran REAL*16 matches the bit representation of the
|
||||
corresponding C type, *and*
|
||||
- we have fortran COMPILEX*32
|
||||
Only then do we put in function pointers for COMPLEX*32 reductions.
|
||||
Otherwise, just put in NULL. */
|
||||
#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_REAL16_MATCHES_C && OMPI_HAVE_FORTRAN_COMPLEX32
|
||||
#define COMPLEX32(name) { ompi_mpi_op_##name##_fortran_complex32 }
|
||||
#define COMPLEX32_3BUFF(name) { ompi_mpi_op_three_buff_##name##_fortran_complex32 }
|
||||
#else
|
||||
|
@ -626,14 +626,14 @@ void ompi_info::do_config(bool want_all)
|
||||
out("Fort have real8", "compiler:fortran:have:real8",
|
||||
OMPI_HAVE_FORTRAN_REAL8 ? "yes" : "no");
|
||||
out("Fort have real16", "compiler:fortran:have:real16",
|
||||
OMPI_HAVE_FORTRAN_REAL16 ? "yes" : "no");
|
||||
OMPI_HAVE_FORTRAN_REAL16 && OMPI_REAL16_MATCHES_C ? "yes" : "no");
|
||||
|
||||
out("Fort have complex8", "compiler:fortran:have:complex8",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX8 ? "yes" : "no");
|
||||
out("Fort have complex16", "compiler:fortran:have:complex16",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX16 ? "yes" : "no");
|
||||
out("Fort have complex32", "compiler:fortran:have:complex32",
|
||||
OMPI_HAVE_FORTRAN_COMPLEX32 ? "yes" : "no");
|
||||
OMPI_HAVE_FORTRAN_COMPLEX32 && OMPI_REAL16_MATCHES_C ? "yes" : "no");
|
||||
|
||||
out("Fort integer1 size", "compiler:fortran:sizeof:integer1",
|
||||
OMPI_HAVE_FORTRAN_INTEGER1 ? OMPI_SIZEOF_FORTRAN_INTEGER1 : -1);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user