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

Commit ee8ec56

Browse files
committed
fortran: moar fixes for the Fortran MPI_SIZEOF debacle
Ensure to define ompi/pompi versions for platforms that don't have weak symbols. Also make fortran/mpif-h/profile build a separate sizeof library, just like fortran/mpifh-h does. (cherry picked from commit 9f345bd)
1 parent 7f69027 commit ee8ec56

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,24 @@ sub output_file {
227227
! compiler to build Open MPI.\n\n";
228228

229229
if ($want_bodies) {
230+
my $name = "ompi_sad_panda";
231+
$name = "pompi_sad_panda"
232+
if ($pmpi_arg);
230233
print OUT "!
231234
! Dummy subroutine, just so that there is *some* Fortran in this file
232-
! (some compilers are unhappy if there are no Fortran statements in this
235+
! (this is defensive programming: since the Fortran compiler doesn't
236+
! support enough mojo, configure should set some AM_CONDITIONALs such
237+
! that this file should not end up being compiled, but just in case
238+
! that logic changes someday and this file *does* end up getting
239+
! compiled, make sure that it's not entirely empty because some
240+
! compilers are unhappy if there are no Fortran statements in this
233241
! file).
234-
subroutine ompi_sad_panda()
242+
subroutine $name()
235243
implicit none
236244
237245
print *, 'Open MPI is a sad panda because your Fortran compiler'
238246
print *, 'does not support enough Fortran mojo for MPI_SIZEOF'
239-
end subroutine ompi_sad_panda\n\n";
247+
end subroutine $name\n\n";
240248
}
241249
}
242250

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)