Skip to content

Commit edd0512

Browse files
authored
Merge pull request #8716 from jsquyres/pr/mpifort-fixes
mpifort fixes
2 parents 856a2b7 + 1fd5fbd commit edd0512

File tree

5 files changed

+48
-10
lines changed

5 files changed

+48
-10
lines changed

config/ompi_setup_fc.m4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ AC_DEFUN([OMPI_SETUP_FC],[
6161
# Autoconf (version >= 2.64) docs.
6262
AC_REQUIRE([_OMPI_SETUP_FC_COMPILER])
6363

64+
# If $FC is "no", that's another way of the user telling us "I
65+
# don't want any Fortran compiler". That being said, there are
66+
# already existing code paths that expect an empty $FC to mean "no
67+
# Fortran compiler", so turn "no" into "" here.
68+
AS_IF([test "$FC" = "no"], [FC=])
69+
6470
AS_IF([test -z "$FC"],
6571
[AC_MSG_WARN([*** All Fortran MPI bindings disabled (could not find compiler)])
6672
ompi_fc_happy=0],

config/ompi_setup_mpi_fortran.m4

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
9797
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS],
9898
[OMPI_SETUP_FC([ompi_fortran_happy=1])])
9999

100+
AM_CONDITIONAL([OMPI_HAVE_FORTRAN_COMPILER], [test -n "$FC"])
101+
100102
# These values will be determined by SETUP_FC. We must always
101103
# AC_DEFINE these results, even in the --disable-mpi-fortran case,
102104
# for ompi_info.
@@ -647,6 +649,18 @@ end type test_mpi_handle],
647649
[$OMPI_FORTRAN_HAVE_STORAGE_SIZE],
648650
[Whether the compiler supports STORAGE_SIZE on relevant types])
649651

652+
# This token is used in the mpifort wrapper compiler data file.
653+
# If we are building the Fortran bindings, then include
654+
# -lompi_mpifh in the link line. If we're not building the
655+
# Fortran bindings, then do not include that token in the link
656+
# line (because we'll still install mpifort to link Fortran
657+
# applications with the C bindings, even if the Fortran MPI
658+
# bindings are not being built).
659+
AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS],
660+
[OMPI_FORTRAN_MPIFH_LINK=-l${OMPI_LIBMPI_NAME}_mpifh],
661+
[OMPI_FORTRAN_MPIFH_LINK=])
662+
AC_SUBST(OMPI_FORTRAN_MPIFH_LINK)
663+
650664
# This conditional is used to determine whether we compile the
651665
# various .f90 files that contain MPI_SIZEOF implementations.
652666
AM_CONDITIONAL([BUILD_FORTRAN_SIZEOF],

ompi/tools/wrappers/Makefile.am

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# University of Stuttgart. All rights reserved.
1010
# Copyright (c) 2004-2005 The Regents of the University of California.
1111
# All rights reserved.
12-
# Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
12+
# Copyright (c) 2006-2021 Cisco Systems, Inc. All rights reserved.
1313
# Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved.
1414
# Copyright (c) 2013 Intel, Inc. All rights reserved.
1515
# Copyright (c) 2014 Research Organization for Information Science
@@ -24,12 +24,16 @@
2424

2525
include $(top_srcdir)/Makefile.ompi-rules
2626

27-
generated_man_pages = mpicc.1 mpifort.1 mpif77.1 mpif90.1
27+
generated_man_pages = mpicc.1
2828

2929
if OMPI_HAVE_CXX_COMPILER
3030
generated_man_pages += mpic++.1 mpicxx.1
3131
endif
3232

33+
if OMPI_HAVE_FORTRAN_COMPILER
34+
generated_man_pages += mpifort.1 mpif77.1 mpif90.1
35+
endif
36+
3337
if OMPI_WANT_JAVA_BINDINGS
3438
generated_man_pages += mpijavac.1
3539
endif
@@ -53,9 +57,11 @@ if OMPI_HAVE_CXX_COMPILER
5357
(cd $(DESTDIR)$(bindir); rm -f mpic++; $(LN_S) ompi_wrapper_script mpic++)
5458
(cd $(DESTDIR)$(bindir); rm -f mpicxx; $(LN_S) ompi_wrapper_script mpicxx)
5559
endif
60+
if OMPI_HAVE_FORTRAN_COMPILER
5661
(cd $(DESTDIR)$(bindir); rm -f mpifort; $(LN_S) ompi_wrapper_script mpifort)
5762
(cd $(DESTDIR)$(bindir); rm -f mpif77; $(LN_S) ompi_wrapper_script mpif77)
5863
(cd $(DESTDIR)$(bindir); rm -f mpif90; $(LN_S) ompi_wrapper_script mpif90)
64+
endif
5965
if OMPI_WANT_JAVA_BINDINGS
6066
(cp mpijavac.pl $(DESTDIR)$(bindir))
6167
(cd $(DESTDIR)$(bindir); chmod +x mpijavac.pl; rm -f mpijavac; $(LN_S) mpijavac.pl mpijavac)
@@ -85,36 +91,44 @@ else # OPAL_WANT_SCRIPT_WRAPPER_COMPILERS
8591
if OPAL_INSTALL_BINARIES
8692

8793
pkgconfigdir = $(libdir)/pkgconfig
88-
pkgconfig_DATA = ompi.pc ompi-c.pc ompi-fort.pc
94+
pkgconfig_DATA = ompi.pc ompi-c.pc
8995

9096
if OMPI_HAVE_CXX_COMPILER
9197
pkgconfig_DATA += ompi-cxx.pc
9298
endif
9399

100+
if OMPI_HAVE_FORTRAN_COMPILER
101+
pkgconfig_DATA += ompi-fort.pc
102+
endif
103+
94104
if OMPI_WANT_JAVA_BINDINGS
95105
bin_SCRIPTS = mpijavac.pl
96106
endif
97107

98108
man_MANS = $(man_pages)
99109

100-
nodist_ompidata_DATA = \
101-
mpicc-wrapper-data.txt \
102-
mpifort-wrapper-data.txt
110+
nodist_ompidata_DATA = mpicc-wrapper-data.txt
103111

104112
if OMPI_HAVE_CXX_COMPILER
105113
nodist_ompidata_DATA += mpic++-wrapper-data.txt
106114
endif
107115

116+
if OMPI_HAVE_FORTRAN_COMPILER
117+
nodist_ompidata_DATA += mpifort-wrapper-data.txt
118+
endif
119+
108120
install-exec-hook-always:
109121
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
110122
(cd $(DESTDIR)$(bindir); rm -f mpicc$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpicc$(EXEEXT))
111123
if OMPI_HAVE_CXX_COMPILER
112124
(cd $(DESTDIR)$(bindir); rm -f mpic++$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpic++$(EXEEXT))
113125
(cd $(DESTDIR)$(bindir); rm -f mpicxx$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpicxx$(EXEEXT))
114126
endif
127+
if OMPI_HAVE_FORTRAN_COMPILER
115128
(cd $(DESTDIR)$(bindir); rm -f mpifort$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpifort$(EXEEXT))
116129
(cd $(DESTDIR)$(bindir); rm -f mpif77$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpif77$(EXEEXT))
117130
(cd $(DESTDIR)$(bindir); rm -f mpif90$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpif90$(EXEEXT))
131+
endif
118132
if OMPI_WANT_JAVA_BINDINGS
119133
(cp mpijavac.pl $(DESTDIR)$(bindir))
120134
(cd $(DESTDIR)$(bindir); chmod +x mpijavac.pl; rm -f mpijavac; $(LN_S) mpijavac.pl mpijavac)
@@ -124,10 +138,12 @@ install-data-hook-always:
124138
if OMPI_HAVE_CXX_COMPILER
125139
(cd $(DESTDIR)$(pkgdatadir); rm -f mpicxx-wrapper-data.txt; $(LN_S) mpic++-wrapper-data.txt mpicxx-wrapper-data.txt)
126140
endif
141+
if OMPI_HAVE_FORTRAN_COMPILER
127142
(cd $(DESTDIR)$(pkgdatadir); rm -f mpif77-wrapper-data.txt; $(LN_S) mpifort-wrapper-data.txt mpif77-wrapper-data.txt)
128143
(cd $(DESTDIR)$(pkgdatadir); rm -f mpif90-wrapper-data.txt; $(LN_S) mpifort-wrapper-data.txt mpif90-wrapper-data.txt)
129144
(cd $(DESTDIR)$(pkgconfigdir); rm -f ompi-f77.pc; $(LN_S) ompi-fort.pc ompi-f77.pc)
130145
(cd $(DESTDIR)$(pkgconfigdir); rm -f ompi-f90.pc; $(LN_S) ompi-fort.pc ompi-f90.pc)
146+
endif
131147

132148
uninstall-local-always:
133149
rm -f $(DESTDIR)$(bindir)/mpicc$(EXEEXT) \
@@ -185,16 +201,17 @@ mpicc.1: $(top_builddir)/opal/tools/wrappers/generic_wrapper.1
185201
rm -f mpicc.1
186202
sed -e 's/#COMMAND#/mpicc/g' -e 's/#PROJECT#/Open MPI/g' -e 's/#PROJECT_SHORT#/OMPI/g' -e 's/#LANGUAGE#/C/g' < $(top_builddir)/opal/tools/wrappers/generic_wrapper.1 > mpicc.1
187203

204+
if OMPI_HAVE_CXX_COMPILER
188205
mpic++.1: $(top_builddir)/opal/tools/wrappers/generic_wrapper.1
189206
rm -f mpic++.1
190207
sed -e 's/#COMMAND#/mpic++/g' -e 's/#PROJECT#/Open MPI/g' -e 's/#PROJECT_SHORT#/OMPI/g' -e 's/#LANGUAGE#/C++/g' < $(top_builddir)/opal/tools/wrappers/generic_wrapper.1 > mpic++.1
191208

192-
if OMPI_HAVE_CXX_COMPILER
193209
mpicxx.1: $(top_builddir)/opal/tools/wrappers/generic_wrapper.1
194210
rm -f mpicxx.1
195211
sed -e 's/#COMMAND#/mpicxx/g' -e 's/#PROJECT#/Open MPI/g' -e 's/#PROJECT_SHORT#/OMPI/g' -e 's/#LANGUAGE#/C++/g' < $(top_builddir)/opal/tools/wrappers/generic_wrapper.1 > mpicxx.1
196212
endif
197213

214+
if OMPI_HAVE_FORTRAN_COMPILER
198215
mpifort.1: $(top_builddir)/opal/tools/wrappers/generic_wrapper.1
199216
rm -f mpifort.1
200217
sed -e 's/#COMMAND#/mpifort/g' -e 's/#PROJECT#/Open MPI/g' -e 's/#PROJECT_SHORT#/OMPI/g' -e 's/#LANGUAGE#/Fortran/g' < $(top_builddir)/opal/tools/wrappers/generic_wrapper.1 > mpifort.1
@@ -214,3 +231,4 @@ mpif77.1: mpif77.1in
214231
mpif90.1: mpif77.1
215232
@ rm -f mpif90.1
216233
$(OMPI_V_LN_S) $(LN_S) mpif77.1 mpif90.1
234+
endif

ompi/tools/wrappers/mpifort-wrapper-data.txt.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
1919
# intentionally only link in the MPI libraries (OPAL, etc. are
2020
# pulled in implicitly) because we intend MPI applications to only use
2121
# the MPI API.
22-
libs=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -l@OMPI_LIBMPI_NAME@_mpifh -l@OMPI_LIBMPI_NAME@
23-
libs_static=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -l@OMPI_LIBMPI_NAME@_mpifh -l@OMPI_LIBMPI_NAME@ -l@OPAL_LIB_PREFIX@open-pal @OMPI_WRAPPER_EXTRA_LIBS@
22+
libs=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ @OMPI_FORTRAN_MPIFH_LINK@ -l@OMPI_LIBMPI_NAME@
23+
libs_static=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ @OMPI_FORTRAN_MPIFH_LINK@ -l@OMPI_LIBMPI_NAME@ -l@OPAL_LIB_PREFIX@open-pal @OMPI_WRAPPER_EXTRA_LIBS@
2424
dyn_lib_file=lib@OMPI_LIBMPI_NAME@.@OPAL_DYN_LIB_SUFFIX@
2525
static_lib_file=lib@OMPI_LIBMPI_NAME@.a
2626
required_file=@OMPI_WRAPPER_FORTRAN_REQUIRED_FILE@

ompi/tools/wrappers/ompi-fort.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ pkgincludedir=@opalincludedir@
1616
# static linking (they're pulled in by libopen-rte.so's implicit
1717
# dependencies), so only list these in Libs.private.
1818
#
19-
Libs: -L${libdir} @OMPI_PKG_CONFIG_LDFLAGS@ @OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -l@OMPI_LIBMPI_NAME@_mpifh -l@OMPI_LIBMPI_NAME@
19+
Libs: -L${libdir} @OMPI_PKG_CONFIG_LDFLAGS@ @OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ @OMPI_FORTRAN_MPIFH_LINK@ -l@OMPI_LIBMPI_NAME@
2020
Libs.private: -lopen-rte -lopen-pal @OMPI_WRAPPER_EXTRA_LIBS@
2121
Cflags: -I${includedir} @OMPI_WRAPPER_EXTRA_CPPFLAGS@ @OMPI_WRAPPER_EXTRA_FCFLAGS@

0 commit comments

Comments
 (0)