From 5de3d5dde688d1af4fc7c6c33636d5d808f40c0a Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Thu, 6 Jul 2017 16:20:03 +0100 Subject: [PATCH 1/2] Fix MPI_SIZEOF for gfortran 4.8 Add copyrights. Revise the README to take out the 'most notably' statement about GNU Fortran 4.8 Signed-off-by: Chris Ward --- README | 4 ++-- config/ompi_fortran_check_storage_size.m4 | 7 ++++--- ompi/mpi/fortran/base/gen-mpi-sizeof.pl | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README b/README index d723c7c66c..59ff55f61b 100644 --- a/README +++ b/README @@ -19,6 +19,7 @@ Copyright (c) 2013-2015 Intel, Inc. All rights reserved Copyright (c) 2015 NVIDIA Corporation. All rights reserved. Copyright (c) 2017 Los Alamos National Security, LLC. All rights reserved. +Copyright (c) 2017 IBM Corporation. All rights reserved $COPYRIGHT$ @@ -365,8 +366,7 @@ Compiler Notes - All Fortran compilers support the mpif.h/shmem.fh-based bindings, with one exception: the MPI_SIZEOF interfaces will only be present when Open MPI is built with a Fortran compiler that support the - INTERFACE keyword and ISO_FORTRAN_ENV. Most notably, this - excludes the GNU Fortran compiler suite before version 4.9. + INTERFACE keyword and ISO_FORTRAN_ENV. - The level of support provided by the mpi module is based on your Fortran compiler. diff --git a/config/ompi_fortran_check_storage_size.m4 b/config/ompi_fortran_check_storage_size.m4 index 330ac7ce6e..880a476b12 100644 --- a/config/ompi_fortran_check_storage_size.m4 +++ b/config/ompi_fortran_check_storage_size.m4 @@ -11,6 +11,7 @@ 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) 2010-2014 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2017 IBM Corporation. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -61,7 +62,7 @@ SUBROUTINE storage_size_complex32_r1(x, size) COMPLEX(REAL32), DIMENSION(*)::x INTEGER, INTENT(OUT) :: size - size = storage_size(x) / 8 + size = storage_size(x(1)) / 8 END SUBROUTINE storage_size_complex32_r1 SUBROUTINE storage_size_int32_scalar(x, size) @@ -77,7 +78,7 @@ SUBROUTINE storage_size_int32_r1(x, size) INTEGER(INT32), DIMENSION(*)::x INTEGER, INTENT(OUT) :: size - size = storage_size(x) / 8 + size = storage_size(x(1)) / 8 END SUBROUTINE storage_size_int32_r1 SUBROUTINE storage_size_real32_scalar(x, size) @@ -93,7 +94,7 @@ SUBROUTINE storage_size_real32_r1(x, size) REAL(REAL32), DIMENSION(*)::x INTEGER, INTENT(OUT) :: size - size = storage_size(x) / 8 + size = storage_size(x(1)) / 8 END SUBROUTINE storage_size_real32_r1 ]])], [AS_VAR_SET(fortran_storage_size_var, yes)], diff --git a/ompi/mpi/fortran/base/gen-mpi-sizeof.pl b/ompi/mpi/fortran/base/gen-mpi-sizeof.pl index 5ea3dca3a4..b7172dc2ee 100755 --- a/ompi/mpi/fortran/base/gen-mpi-sizeof.pl +++ b/ompi/mpi/fortran/base/gen-mpi-sizeof.pl @@ -3,6 +3,7 @@ # Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2017 IBM Corporation. All rights reserved. # $COPYRIGHT$ # # Script to generate the overloaded MPI_SIZEOF interfaces and @@ -97,7 +98,7 @@ sub queue_sub { ${indent} INTEGER, INTENT(OUT) :: size ${indent} INTEGER$optional_ierror_param, INTENT(OUT) :: ierror"; $subr->{start} = $start; - $subr->{middle} = "${indent} size = storage_size(x) / 8 + $subr->{middle} = "${indent} size = storage_size(xSUBSCRIPT) / 8 ${indent} ${optional_ierror_statement}ierror = 0"; $subr->{end} = "${indent}END SUBROUTINE ^PREFIX^$sub_name^RANK^"; @@ -126,6 +127,7 @@ sub generate { if (0 == $rank) { $str =~ s/\^RANK\^/_scalar/g; $str =~ s/\^DIMENSION\^//; + $str =~ s/SUBSCRIPT//; } else { $str =~ s/\^RANK\^/_r$rank/g; my $dim; @@ -135,6 +137,7 @@ sub generate { --$d; } $str =~ s/\^DIMENSION\^/, DIMENSION($dim*)/; + $str =~ s/SUBSCRIPT/($dim 1)/; } # All done From 75ec541610a37eed68ec7d726e938da8781ebfd7 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 7 Jul 2017 07:30:03 -0700 Subject: [PATCH 2/2] README: minor tweak to specifically mention GNU Fortran Lots of people still use GFortran, and lots of people still use somewhat old versions of it (e.g., if it's bundled in their older-but-still-installed Linux distros). So let's specifically mention it. This may be a bit overkill, but more specific docs are usually a Good Thing (i.e., they can prevent questions from being sent to the mailing list). Signed-off-by: Jeff Squyres --- README | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README b/README index 59ff55f61b..f3d0c7ca6e 100644 --- a/README +++ b/README @@ -368,6 +368,12 @@ Compiler Notes when Open MPI is built with a Fortran compiler that support the INTERFACE keyword and ISO_FORTRAN_ENV. + *** The Open MPI team has not tested to determine exactly which + version of the GNU Fortran compiler suite started supporting + what is required for MPI_SIZEOF. We know that gfortran v4.8 + (bundled in RHEL 7.x) supports the MPI_SIZEOF interfaces. + However, gfortran 4.4 (bundled in RHEL 6.x) does not. + - The level of support provided by the mpi module is based on your Fortran compiler.