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

Commit e059f54

Browse files
committed
Merge pull request #530 from jsquyres/pr/v2.x-fortran-sizeof-wasteland
fortran sizeof: ensure mpi_sizeof*f90 is not empty
2 parents 0fd1475 + 496a7bd commit e059f54

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
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/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.ompi-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
@@ -430,7 +433,19 @@ $(linked_files):
430433

431434
# psizeof_f.f90 is generated based on some results from configure tests.
432435
CLEANFILES += psizeof_f.f90
436+
437+
# Build the MPI_SIZEOF code in a separate convenience library (see
438+
# lengthy comment in ompi/mpi/fortran/mpif-h/Makefile.am for an
439+
# explanation why).
440+
#if BUILD_FORTRAN_SIZEOF
441+
noinst_LTLIBRARIES += libmpi_mpifh_psizeof.la
442+
# Do not dist this file; it is generated
443+
nodist_libmpi_mpifh_psizeof_la_SOURCES = psizeof_f.f90
444+
libmpi_mpifh_pmpi_la_LIBADD += libmpi_mpifh_psizeof.la
445+
#endif
446+
433447
sizeof_pl=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-sizeof.pl
448+
434449
psizeof_f.f90: $(top_builddir)/config.status
435450
psizeof_f.f90: $(sizeof_pl)
436451
psizeof_f.f90:
@@ -445,7 +460,6 @@ psizeof_f.f90:
445460
# The library itself
446461
#
447462
nodist_libmpi_mpifh_pmpi_la_SOURCES = \
448-
psizeof_f.f90 \
449463
$(linked_files)
450464

451465
# Conditionally install the header files

0 commit comments

Comments
 (0)