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

Commit fdeea88

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 6a94e75 commit fdeea88

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.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)