diff --git a/README b/README index 4829ad4c22..173b47b81a 100644 --- a/README +++ b/README @@ -361,10 +361,20 @@ Compiler Notes (but are, as yet, only lightly tested). It is expected that this support will mature over time. - As of this release, the GNU Fortran compiler (gfortran) is *not* - supported with the mpi_f08 module. It is likely that a future - release of Open MPI will provide an mpi_f08 module that will be - compatible with gfortran >= v4.9. + There is a bug in Open MPI's mpi_f08 module that will (correctly) + cause a compile failure when Open MPI is built with a + strict-adherence Fortran compiler. As of this writing, such + compilers include the (as-yet-unreleased) GNU Fortran compiler + v4.9 and the Pathscale EKOPath 5.0 compiler (although Pathscale + has committed to releasing version 5.1 that works around Open + MPI's bug -- kudos!). A future version of Open MPI will fix this + bug. See https://svn.open-mpi.org/trac/ompi/ticket/4157 for more + details. + + The GNU Fortran compiler (gfortran) version < v4.9 is *not* + supported with the mpi_f08 module. Per the previous paragraph, it + is likely that a future release of Open MPI will provide an + mpi_f08 module that will be compatible with gfortran >= v4.9. - All Fortran compilers support the mpif.h/shmem.fh-based bindings. @@ -1215,7 +1225,8 @@ MPI FUNCTIONALITY * With no value for BINDING (i.e., just "--enable-mpi-fortran"): synonym for BINDING=all - * BINDING=all or yes: attempt to build all 3 Fortran bindings + * BINDING=all or yes: attempt to build all 3 Fortran bindings; skip + any binding that cannot be built * BINDING=mpifh: build mpif.h support * BINDING=usempi: build mpif.h and "mpi" module support * BINDING=usempif08: build mpif.h, "mpi" module, and "mpi_f08" diff --git a/config/ompi_fortran_check_ticket_4157.m4 b/config/ompi_fortran_check_ticket_4157.m4 new file mode 100644 index 0000000000..b7f3c92068 --- /dev/null +++ b/config/ompi_fortran_check_ticket_4157.m4 @@ -0,0 +1,98 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# Special check for ticket 4157. This test will eventually disappear. +# See https://svn.open-mpi.org/trac/ompi/ticket/4157. +# +# OMPI_FORTRAN_CHECK_TICKET_4157([action if happy], [action if not happy]) +# ---------------------------------------------------- +AC_DEFUN([OMPI_FORTRAN_CHECK_TICKET_4157],[ + AS_VAR_PUSHDEF([ticket_4157_var], [ompi_cv_fortran_ticket_4157]) + + AC_CACHE_CHECK([for ticket 4157 issues], ticket_4157_var, + [AC_LANG_PUSH([Fortran]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +MODULE MY_ABSTRACT_MODULE + ABSTRACT INTERFACE + SUBROUTINE ABSTRACT_INTERFACE(A, B) + IMPLICIT NONE + INTEGER :: A + LOGICAL :: B + END SUBROUTINE ABSTRACT_INTERFACE + END INTERFACE +END MODULE MY_ABSTRACT_MODULE + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MODULE MY_CONCRETE_MODULE + INTERFACE + SUBROUTINE MY_CONCRETE_SUB(A, B) + IMPLICIT NONE + INTEGER :: A + LOGICAL :: B + END SUBROUTINE MY_CONCRETE_SUB + END INTERFACE +END MODULE MY_CONCRETE_MODULE + +SUBROUTINE MY_CONCRETE_SUB(A, B) + IMPLICIT NONE + INTEGER :: A + LOGICAL :: B + + PRINT *, "I'm in MY_CONCRETE_SUB", A, B +END SUBROUTINE MY_CONCRETE_SUB + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MODULE MY_MODULE + INTERFACE + SUBROUTINE MY_SUB(A, B) BIND(C, NAME="FOO") + USE MY_ABSTRACT_MODULE + IMPLICIT NONE + INTEGER, INTENT(IN) :: A + PROCEDURE(ABSTRACT_INTERFACE) :: B + END SUBROUTINE MY_SUB + END INTERFACE +END MODULE MY_MODULE + +SUBROUTINE MY_SUB(A, B) BIND(C, NAME="FOO") + USE MY_ABSTRACT_MODULE + IMPLICIT NONE + INTEGER, INTENT(IN) :: A + PROCEDURE(ABSTRACT_INTERFACE) :: B + + LOGICAL :: C + + C = .TRUE. + PRINT *, "I'm in MY_SUB", A, C + CALL B(A, C) +END SUBROUTINE MY_SUB + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +PROGRAM TEST_ABSTRACT_PROCEDURE + USE MY_ABSTRACT_MODULE + USE MY_CONCRETE_MODULE + USE MY_MODULE + IMPLICIT NONE + INTEGER :: FOO + + FOO = 3 + CALL MY_SUB(FOO, MY_CONCRETE_SUB) +END PROGRAM TEST_ABSTRACT_PROCEDURE +]])], + [AS_VAR_SET(ticket_4157_var, happy)], + [AS_VAR_SET(ticket_4157_var, unhappy)]) + AC_LANG_POP([Fortran]) + ]) + + AS_VAR_IF(ticket_4157_var, [happy], [$1], [$2]) + AS_VAR_POPDEF([ticket_4157_var]) +]) diff --git a/config/ompi_setup_mpi_fortran.m4 b/config/ompi_setup_mpi_fortran.m4 index cf419686db..61c1c9e079 100644 --- a/config/ompi_setup_mpi_fortran.m4 +++ b/config/ompi_setup_mpi_fortran.m4 @@ -448,6 +448,22 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[ [OMPI_FORTRAN_HAVE_PROCEDURE=1], [OMPI_FORTRAN_HAVE_PROCEDURE=0])]) + # Per https://svn.open-mpi.org/trac/ompi/ticket/4157, temporarily + # disqualify the fortran compiler if it exhibits the behavior + # described in that ticket. Short version: OMPI does something + # non-Fortran that we don't have time to fix 1.7.4. So we just + # disqualify Fortran compilers who actually enforce this issue, + # and we'll fix OMPI to be Fortran-compliant after 1.7.4 + AS_IF([test $OMPI_WANT_FORTRAN_USEMPIF08_BINDINGS -eq 1 && \ + test $OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS -eq 1 && \ + test $OMPI_FORTRAN_HAVE_PROCEDURE -eq 1 && \ + test $OMPI_FORTRAN_HAVE_ABSTRACT -eq 1], + [ # Check for ticket 4157 + OMPI_FORTRAN_CHECK_TICKET_4157( + [], + [ # If we don't have this, don't build the mpi_f08 module + OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS=0])]) + OMPI_FORTRAN_F08_HANDLE_SIZE=4 AS_IF([test $OMPI_WANT_FORTRAN_USEMPIF08_BINDINGS -eq 1 -a \ $OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS -eq 1],