2004-10-24 01:08:12 +04:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
2004-11-22 04:38:40 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
dnl All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
dnl All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
dnl University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
2004-10-24 01:08:12 +04:00
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_DEFUN([OMPI_F77_GET_FORTRAN_HANDLE_MAX],[
|
|
|
|
# Find the maximum value of fortran integers, then calculate
|
|
|
|
# min(INT_MAX, max fortran INTEGER). This represents the maximum
|
|
|
|
# number of fortran MPI handle index.
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for max fortran MPI handle index])
|
|
|
|
|
|
|
|
# Find max fortran INTEGER value. Set to sentinel value if we don't
|
|
|
|
# have a Fortran compiler (e.g., if --disable-f77 was given)
|
|
|
|
|
|
|
|
if test "$OMPI_WANT_F77_BINDINGS" = "0" ; then
|
2005-07-05 00:00:54 +04:00
|
|
|
ompi_fint_max=0
|
2004-10-24 01:08:12 +04:00
|
|
|
else
|
A bunch of changes to support MPI_INTEGER*x, MPI_REAL*x,
MPI_COMPLEX*x, and some optional C datatypes in MPI reduction
operations. These types are not technically supported by the letter
of the MPI standard, but are implied by the spirit of it (and there
are definitely users that use them in real applications)
- Add checks in configure for back-end C types for MPI_INTEGER*x and
MPI_REAL*x
- Create C data structs for MPI_COMPLEX*x
- Fixed typo for MPI_INTEGER8 in mpi.h
- Updated configure macros to create MPI_FORTRAN_INTEGER* defines, as
opposed to MPI_FORTRAN_INT, which was causing [me] lots of confusion
(between C "*_INT" names and Fortran "*_INT" names). This caused
some trivial updates in ddt, ompi_info, and the MPI layer to match.
- Update ompi_info to show whether we have each MPI_INTEGER*x,
MPI_REAL*x, and MPI_COMPLEX*x
- Extended reduction operations for optional datatypes:
- "C integer" now includes long long int, long long, and unsigned
long long
- "Fortran integer" now includes MPI_INTEGER*x
- "Floating point" now includes MPI_REAL*x
- "Complex" now includes MPI_COMPLEX*x
This commit was SVN r5511.
2005-04-27 14:23:06 +04:00
|
|
|
ompi_sizeof_fint=`expr $OMPI_SIZEOF_FORTRAN_INTEGER \* 8 - 1`
|
2004-10-24 01:08:12 +04:00
|
|
|
ompi_fint_max=1
|
|
|
|
while test "$ompi_sizeof_fint" != "0"; do
|
|
|
|
ompi_fint_max=`expr $ompi_fint_max \* 2`
|
|
|
|
ompi_sizeof_fint=`expr $ompi_sizeof_fint - 1`
|
|
|
|
done
|
|
|
|
ompi_fint_max=`expr $ompi_fint_max - 1`
|
|
|
|
fi
|
|
|
|
|
2005-07-05 00:00:54 +04:00
|
|
|
# Get INT_MAX. Compute a SWAG if we are cross compiling or something
|
|
|
|
# goes wrong.
|
2004-10-24 01:08:12 +04:00
|
|
|
rm -f conftest.out > /dev/null 2>&1
|
|
|
|
AC_RUN_IFELSE(AC_LANG_PROGRAM([[
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <limits.h>
|
|
|
|
]],[[FILE *fp = fopen("conftest.out", "w");
|
|
|
|
long cint = INT_MAX;
|
2005-07-05 00:00:54 +04:00
|
|
|
fprintf(fp, "%ld", cint);
|
|
|
|
fclose(fp);]]), [ompi_cint_max=`cat conftest.out`],
|
|
|
|
[ompi_cint_max=0], [ #cross compiling is fun
|
2005-07-06 17:18:44 +04:00
|
|
|
# try to compute INT_MAX the same way we computed Fortran INTEGER max.
|
2005-07-05 00:00:54 +04:00
|
|
|
ompi_sizeof_cint=`expr $ac_cv_sizeof_int \* 8 - 1`
|
|
|
|
ompi_cint_max=1
|
|
|
|
while test "$ompi_sizeof_cint" != "0" ; do
|
|
|
|
ompi_cint_max=`expr $ompi_cint_max \* 2`
|
|
|
|
ompi_sizeof_cint=`expr $ompi_sizeof_cint - 1`
|
|
|
|
done
|
|
|
|
ompi_cint_max=`expr $ompi_cint_max - 1`])
|
|
|
|
|
|
|
|
if test "$ompi_cint_max" = "0" ; then
|
|
|
|
# wow - something went really wrong. Be conservative
|
2004-10-24 01:08:12 +04:00
|
|
|
OMPI_FORTRAN_HANDLE_MAX=32767
|
2005-07-05 00:00:54 +04:00
|
|
|
elif test "$ompi_fint_max" = "0" ; then
|
2005-07-06 17:18:44 +04:00
|
|
|
# we aren't compiling Fortran - just set it to C INT_MAX
|
2005-07-05 00:00:54 +04:00
|
|
|
OMPI_FORTRAN_HANDLE_MAX=$ompi_cint_max
|
|
|
|
else
|
2005-07-06 17:18:44 +04:00
|
|
|
# take the lesser of C INT_MAX and Fortran INTEGER max.
|
|
|
|
# The resulting value will then be storable in either type.
|
|
|
|
if test $ompi_cint_max -lt $ompi_fint_max ; then
|
2005-07-05 00:00:54 +04:00
|
|
|
OMPI_FORTRAN_HANDLE_MAX=$ompi_cint_max
|
|
|
|
else
|
|
|
|
OMPI_FORTRAN_HANDLE_MAX=$ompi_fint_max
|
|
|
|
fi
|
2004-10-24 01:08:12 +04:00
|
|
|
fi
|
|
|
|
rm -f conftest.out > /dev/null 2>&1
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HANDLE_MAX,
|
|
|
|
$OMPI_FORTRAN_HANDLE_MAX,
|
|
|
|
[Max handle value for fortran MPI handles, effectively min(INT_MAX, max fortran INTEGER value)])
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$OMPI_FORTRAN_HANDLE_MAX])
|
|
|
|
])dnl
|