Skip to content

Commit 83746fb

Browse files
authored
Merge pull request #3822 from tjcw/tjcw-fix-mpi-sizeof
Fix MPI_SIZEOF for gfortran 4.8
2 parents b2f90e5 + 3e6a196 commit 83746fb

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

README

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Copyright (c) 2013-2015 Intel, Inc. All rights reserved
1919
Copyright (c) 2015 NVIDIA Corporation. All rights reserved.
2020
Copyright (c) 2017 Los Alamos National Security, LLC. All rights
2121
reserved.
22+
Copyright (c) 2017 IBM Corporation. All rights reserved
2223

2324
$COPYRIGHT$
2425

@@ -370,8 +371,13 @@ Compiler Notes
370371
- All Fortran compilers support the mpif.h/shmem.fh-based bindings,
371372
with one exception: the MPI_SIZEOF interfaces will only be present
372373
when Open MPI is built with a Fortran compiler that support the
373-
INTERFACE keyword and ISO_FORTRAN_ENV. Most notably, this
374-
excludes the GNU Fortran compiler suite before version 4.9.
374+
INTERFACE keyword and ISO_FORTRAN_ENV.
375+
376+
*** The Open MPI team has not tested to determine exactly which
377+
version of the GNU Fortran compiler suite started supporting
378+
what is required for MPI_SIZEOF. We know that gfortran v4.8
379+
(bundled in RHEL 7.x) supports the MPI_SIZEOF interfaces.
380+
However, gfortran 4.4 (bundled in RHEL 6.x) does not.
375381

376382
- The level of support provided by the mpi module is based on your
377383
Fortran compiler.

config/ompi_fortran_check_storage_size.m4

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
14+
dnl Copyright (c) 2017 IBM Corporation. All rights reserved.
1415
dnl $COPYRIGHT$
1516
dnl
1617
dnl Additional copyrights may follow
@@ -61,7 +62,7 @@ SUBROUTINE storage_size_complex32_r1(x, size)
6162
COMPLEX(REAL32), DIMENSION(*)::x
6263
INTEGER, INTENT(OUT) :: size
6364

64-
size = storage_size(x) / 8
65+
size = storage_size(x(1)) / 8
6566
END SUBROUTINE storage_size_complex32_r1
6667

6768
SUBROUTINE storage_size_int32_scalar(x, size)
@@ -77,7 +78,7 @@ SUBROUTINE storage_size_int32_r1(x, size)
7778
INTEGER(INT32), DIMENSION(*)::x
7879
INTEGER, INTENT(OUT) :: size
7980

80-
size = storage_size(x) / 8
81+
size = storage_size(x(1)) / 8
8182
END SUBROUTINE storage_size_int32_r1
8283

8384
SUBROUTINE storage_size_real32_scalar(x, size)
@@ -93,7 +94,7 @@ SUBROUTINE storage_size_real32_r1(x, size)
9394
REAL(REAL32), DIMENSION(*)::x
9495
INTEGER, INTENT(OUT) :: size
9596

96-
size = storage_size(x) / 8
97+
size = storage_size(x(1)) / 8
9798
END SUBROUTINE storage_size_real32_r1
9899
]])],
99100
[AS_VAR_SET(fortran_storage_size_var, yes)],

ompi/mpi/fortran/base/gen-mpi-sizeof.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
44
# Copyright (c) 2015 Research Organization for Information Science
55
# and Technology (RIST). All rights reserved.
6+
# Copyright (c) 2017 IBM Corporation. All rights reserved.
67
# $COPYRIGHT$
78
#
89
# Script to generate the overloaded MPI_SIZEOF interfaces and
@@ -97,7 +98,7 @@ sub queue_sub {
9798
${indent} INTEGER, INTENT(OUT) :: size
9899
${indent} INTEGER$optional_ierror_param, INTENT(OUT) :: ierror";
99100
$subr->{start} = $start;
100-
$subr->{middle} = "${indent} size = storage_size(x) / 8
101+
$subr->{middle} = "${indent} size = storage_size(xSUBSCRIPT) / 8
101102
${indent} ${optional_ierror_statement}ierror = 0";
102103
$subr->{end} = "${indent}END SUBROUTINE ^PREFIX^$sub_name^RANK^";
103104

@@ -126,6 +127,7 @@ sub generate {
126127
if (0 == $rank) {
127128
$str =~ s/\^RANK\^/_scalar/g;
128129
$str =~ s/\^DIMENSION\^//;
130+
$str =~ s/SUBSCRIPT//;
129131
} else {
130132
$str =~ s/\^RANK\^/_r$rank/g;
131133
my $dim;
@@ -135,6 +137,7 @@ sub generate {
135137
--$d;
136138
}
137139
$str =~ s/\^DIMENSION\^/, DIMENSION($dim*)/;
140+
$str =~ s/SUBSCRIPT/($dim 1)/;
138141
}
139142

140143
# All done

0 commit comments

Comments
 (0)