Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit e6f1733

Browse files
committed
Merge pull request #529 from jsquyres/pr/v1.10-fortran-sizeof-wasteland
fortran sizeof: ensure mpi_sizeof*f90 is not empty
2 parents 45b16e4 + 69b2b27 commit e6f1733

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env perl
22
#
3-
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
3+
# 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.
66
# $COPYRIGHT$
@@ -218,12 +218,32 @@ sub output_file {
218218
! Specifically: we need support for the INTERFACE keyword,
219219
! ISO_FORTRAN_ENV, and the STORAGE_SIZE() intrinsic on all types.
220220
! Apparently, this compiler does not support both of those things, so
221-
! this file will be blank (i.e., we didn't bother generating the
222-
! necessary stuff for MPI_SIZEOF because the compiler doesn't support
221+
! this file will be (effecitvely) blank (i.e., we didn't bother
222+
! generating the necessary stuff for MPI_SIZEOF because the compiler
223+
! doesn't support
223224
! it).
224225
!
225226
! If you want support for MPI_SIZEOF, please use a different Fortran
226227
! compiler to build Open MPI.\n\n";
228+
229+
if ($want_bodies) {
230+
my $name = $pmpi_arg ? "pompi_sad_panda" : "ompi_sad_panda";
231+
print OUT "!
232+
! Dummy subroutine, just so that there is *some* Fortran in this file
233+
! (this is defensive programming: since the Fortran compiler doesn't
234+
! support enough mojo, configure should set some AM_CONDITIONALs such
235+
! that this file should not end up being compiled, but just in case
236+
! that logic changes someday and this file *does* end up getting
237+
! compiled, make sure that it's not entirely empty because some
238+
! compilers are unhappy if there are no Fortran statements in this
239+
! file).
240+
subroutine $name()
241+
implicit none
242+
243+
print *, 'Open MPI is a sad panda because your Fortran compiler'
244+
print *, 'does not support enough Fortran mojo for MPI_SIZEOF'
245+
end subroutine $name\n\n";
246+
}
227247
}
228248

229249
close(OUT);

ompi/mpi/fortran/mpif-h/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ MOSTLYCLEANFILES = *.mod
109109
# out this workaround indefinitely. So Jeff advised Absoft to fix
110110
# this bug in Sep 2014.
111111
if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS
112-
noinst_LTLIBRARIES += libmpi_mpifh_sizeof.la
113112

114113
if BUILD_FORTRAN_SIZEOF
114+
noinst_LTLIBRARIES += libmpi_mpifh_sizeof.la
115115
# Do not dist this file; it is generated
116116
nodist_libmpi_mpifh_sizeof_la_SOURCES = sizeof_f.f90
117-
endif
118117
libmpi_mpifh_la_LIBADD += libmpi_mpifh_sizeof.la
118+
endif
119119

120120
sizeof_pl = $(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-sizeof.pl
121121

ompi/mpi/fortran/mpif-h/profile/Makefile.am

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# University of Stuttgart. All rights reserved.
1111
# Copyright (c) 2004-2005 The Regents of the University of California.
1212
# All rights reserved.
13-
# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
13+
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
1414
# Copyright (c) 2011-2013 Inria. All rights reserved.
1515
# Copyright (c) 2011-2013 Universite Bordeaux 1
1616
# Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
@@ -26,6 +26,9 @@
2626

2727
include $(top_srcdir)/Makefile.man-page-rules
2828

29+
CLEANFILES=
30+
libmpi_mpifh_pmpi_la_LIBADD =
31+
2932
#
3033
# OMPI_PROFILING_DEFINES flag is enabled when we want our MPI_* symbols
3134
# to be replaced by PMPI_*. In other words, this flag decides
@@ -421,7 +424,19 @@ $(linked_files):
421424

422425
# psizeof_f.f90 is generated based on some results from configure tests.
423426
CLEANFILES += psizeof_f.f90
427+
428+
# Build the MPI_SIZEOF code in a separate convenience library (see
429+
# lengthy comment in ompi/mpi/fortran/mpif-h/Makefile.am for an
430+
# explanation why).
431+
if BUILD_FORTRAN_SIZEOF
432+
noinst_LTLIBRARIES += libmpi_mpifh_psizeof.la
433+
# Do not dist this file; it is generated
434+
nodist_libmpi_mpifh_psizeof_la_SOURCES = psizeof_f.f90
435+
libmpi_mpifh_pmpi_la_LIBADD += libmpi_mpifh_psizeof.la
436+
endif
437+
424438
sizeof_pl=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-sizeof.pl
439+
425440
psizeof_f.f90: $(top_builddir)/config.status
426441
psizeof_f.f90: $(sizeof_pl)
427442
psizeof_f.f90:
@@ -436,7 +451,6 @@ psizeof_f.f90:
436451
# The library itself
437452
#
438453
nodist_libmpi_mpifh_pmpi_la_SOURCES = \
439-
psizeof_f.f90 \
440454
$(linked_files)
441455

442456
# Conditionally install the header files

0 commit comments

Comments
 (0)