Skip to content

Commit 2c71c27

Browse files
committed
fortran2008: fix mpiext example
in order to solve an egg and the chicken problem, in which mpiext need mpi-f08-types.mod and/but use-mpi-f08[-desc] needs mpiext, add an extra step - build fortran 2008 modules only - build fortran 2008 mpi extensions - and then build fortran 2008 bindings Fixes open-mpi#3605 Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 9b43de1 commit 2c71c27

File tree

16 files changed

+203
-56
lines changed

16 files changed

+203
-56
lines changed

config/ompi_config_files.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# -*- shell-script -*-
22
#
33
# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
4+
# Copyright (c) 2017 Research Organization for Information Science
5+
# and Technology (RIST). All rights reserved.
46
# $COPYRIGHT$
57
#
68
# Additional copyrights may follow
@@ -32,7 +34,9 @@ AC_DEFUN([OMPI_CONFIG_FILES],[
3234
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-interfaces.h
3335
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h
3436
ompi/mpi/fortran/use-mpi-f08/Makefile
37+
ompi/mpi/fortran/use-mpi-f08/mod/Makefile
3538
ompi/mpi/fortran/use-mpi-f08-desc/Makefile
39+
ompi/mpi/fortran/use-mpi-f08-desc/mod/Makefile
3640
ompi/mpi/fortran/mpiext/Makefile
3741
ompi/mpi/tool/Makefile
3842
ompi/mpi/tool/profile/Makefile

config/ompi_setup_mpi_fortran.m4

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dnl Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
1515
dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
1616
dnl reserved.
1717
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
18-
dnl Copyright (c) 2014-2016 Research Organization for Information Science
18+
dnl Copyright (c) 2014-2017 Research Organization for Information Science
1919
dnl and Technology (RIST). All rights reserved.
2020
dnl Copyright (c) 2016 IBM Corporation. All rights reserved.
2121
dnl $COPYRIGHT$
@@ -35,6 +35,7 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
3535
OMPI_FORTRAN_USEMPI_LIB=
3636

3737
OMPI_FORTRAN_USEMPIF08_DIR=
38+
OMPI_FORTRAN_USEMPIF08_MOD=
3839
OMPI_FORTRAN_USEMPIF08_LIB=
3940

4041
OMPI_FORTRAN_MAX_ARRAY_RANK=0
@@ -543,12 +544,14 @@ end type test_mpi_handle],
543544
AS_IF([test $OMPI_BUILD_FORTRAN_F08_SUBARRAYS -eq 1],
544545
[ # Case a) partial/prototype implementation
545546
OMPI_FORTRAN_USEMPIF08_DIR=mpi/fortran/use-mpi-f08-desc
547+
OMPI_FORTRAN_USEMPIF08_MOD=$OMPI_FORTRAN_USEMPIF08_DIR/mod
546548
OMPI_FORTRAN_SUBARRAYS_SUPPORTED=.TRUE.
547549
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=0
548550
AC_MSG_RESULT([array subsections (partial/experimental)])
549551
],
550552
[ # Both cases b) and c)
551553
OMPI_FORTRAN_USEMPIF08_DIR=mpi/fortran/use-mpi-f08
554+
OMPI_FORTRAN_USEMPIF08_MOD=$OMPI_FORTRAN_USEMPIF08_DIR/mod
552555
OMPI_FORTRAN_SUBARRAYS_SUPPORTED=.FALSE.
553556
AS_IF([test $OMPI_FORTRAN_HAVE_OPTIONAL_ARGS -eq 1],
554557
[ # Case b) "good compiler"
@@ -701,6 +704,7 @@ end type test_mpi_handle],
701704

702705
# This goes into ompi/Makefile.am
703706
AC_SUBST(OMPI_FORTRAN_USEMPIF08_DIR)
707+
AC_SUBST(OMPI_FORTRAN_USEMPIF08_MOD)
704708
# This goes into mpifort-wrapper-data.txt
705709
AC_SUBST(OMPI_FORTRAN_USEMPIF08_LIB)
706710

ompi/Makefile.am

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
1616
# reserved.
1717
# Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
18-
# Copyright (c) 2015 Research Organization for Information Science
18+
# Copyright (c) 2015-2017 Research Organization for Information Science
1919
# and Technology (RIST). All rights reserved.
2020
# Copyright (c) 2016 IBM Corporation. All rights reserved.
2121
# $COPYRIGHT$
@@ -90,6 +90,7 @@ SUBDIRS = \
9090
mpi/fortran/mpif-h \
9191
$(OMPI_MPIEXT_USEMPI_DIR) \
9292
$(OMPI_FORTRAN_USEMPI_DIR) \
93+
$(OMPI_FORTRAN_USEMPIF08_MOD) \
9394
$(OMPI_MPIEXT_USEMPIF08_DIRS) \
9495
$(OMPI_FORTRAN_USEMPIF08_DIR) \
9596
mpi/fortran/mpiext \
@@ -119,7 +120,9 @@ DIST_SUBDIRS = \
119120
mpi/fortran/use-mpi-tkr \
120121
mpi/fortran/use-mpi-ignore-tkr \
121122
mpi/fortran/use-mpi-f08 \
123+
mpi/fortran/use-mpi-f08/mod \
122124
mpi/fortran/use-mpi-f08-desc \
125+
mpi/fortran/use-mpi-f08-desc/mod \
123126
mpi/fortran/mpiext \
124127
mpi/java \
125128
$(OMPI_MPIEXT_ALL_SUBDIRS) \

ompi/mpi/fortran/mpiext/Makefile.am

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#
2-
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
2+
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
3+
# Copyright (c) 2017 Research Organization for Information Science
4+
# and Technology (RIST). All rights reserved.
35
# $COPYRIGHT$
46
#
57
# Additional copyrights may follow
@@ -18,6 +20,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT
1820

1921
AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
2022
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \
23+
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPIF08_MOD) \
2124
-I$(top_srcdir) $(FCFLAGS_f90)
2225

2326
flibs =
@@ -61,7 +64,7 @@ libforce_usempif08_module_to_be_built_la_SOURCES = mpi-f08-ext-module.F90
6164
# manually here. Bummer!
6265
#
6366

64-
mpi_f08_ext.lo: $(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mpi-f08-types.lo
67+
mpi_f08_ext.lo: $(top_builddir)/ompi/mpi/fortran/use-mpi-f08-modules/mpi-f08-types.lo
6568
mpi_f08_ext.lo: mpi-f08-ext-module.F90
6669
endif
6770

ompi/mpi/fortran/use-mpi-f08-desc/Makefile.am

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- makefile -*-
22
#
33
# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
4-
# Copyright (c) 2015 Research Organization for Information Science
4+
# Copyright (c) 2015-2017 Research Organization for Information Science
55
# and Technology (RIST). All rights reserved.
66
# Copyright (c) 2016 IBM Corporation. All rights reserved.
77
#
@@ -17,10 +17,12 @@
1717
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
1818

1919
AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
20-
-I$(top_srcdir) $(FCFLAGS)
20+
-I$(top_srcdir) -Imod $(FCFLAGS)
2121

2222
lib_LTLIBRARIES = lib@OMPI_LIBMPI_NAME@_usempif08.la
2323

24+
module_sentinel_file = \
25+
mod/libforce_usempif08_internal_modules_to_be_built.la
2426
#
2527
# This list is a subset of the full MPI API used for testing Fortran
2628
# descriptors usage in MPI-3
@@ -38,8 +40,6 @@ mpi_api_files = \
3840

3941
lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = \
4042
$(mpi_api_files) \
41-
mpi-f08-types.f90 \
42-
mpi-f08-interfaces.F90 \
4343
mpi-f-interfaces-bind.h \
4444
mpi-f08.f90 \
4545
ISO_Fortran_binding.h \
@@ -59,9 +59,7 @@ MOSTLYCLEANFILES = *.mod
5959
# manually here. Bummer!
6060
#
6161

62-
mpi-f08-types.lo: mpi-f08-types.f90
63-
mpi-f08-interfaces.lo: mpi-f08-interfaces.F90 mpi-f08-types.lo
64-
OMPI_Fortran_binding.lo: OMPI_Fortran_binding.f90 mpi-f08-types.lo
62+
OMPI_Fortran_binding.lo: OMPI_Fortran_binding.f90 mod/mpi-f08-types.lo
6563

6664

6765
#
@@ -73,9 +71,8 @@ mpi_api_lo_files = $(mpi_api_files:.f90=.lo)
7371

7472
$(mpi_api_lo_files): mpi-f08.lo
7573

76-
mpi-f08.lo: mpi-f08-types.lo
74+
mpi-f08.lo: $(module_sentinel_file)
7775
mpi-f08.lo: OMPI_Fortran_binding.lo
78-
mpi-f08.lo: mpi-f08-interfaces.lo
7976
mpi-f08.lo: mpi-f-interfaces-bind.h
8077
mpi-f08.lo: mpi-f08.f90
8178

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# -*- makefile -*-
2+
#
3+
# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
4+
# Copyright (c) 2015 Research Organization for Information Science
5+
# and Technology (RIST). All rights reserved.
6+
# Copyright (c) 2016 IBM Corporation. All rights reserved.
7+
#
8+
# $COPYRIGHT$
9+
#
10+
# Additional copyrights may follow
11+
#
12+
# $HEADER$
13+
#
14+
15+
# This Makefile is only relevant if we're building the "use mpi_f08"
16+
# MPI bindings.
17+
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
18+
19+
AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
20+
-I$(top_srcdir) $(FCFLAGS)
21+
22+
module_sentinel_file = \
23+
libforce_usempif08_internal_modules_to_be_built.la
24+
25+
noinst_LTLIBRARIES = $(module_sentinel_file)
26+
27+
# f08 support modules
28+
29+
libforce_usempif08_internal_modules_to_be_built_la_SOURCES = \
30+
mpi-f08-types.f90 \
31+
mpi-f08-interfaces.F90
32+
33+
#
34+
# Clean up all F90 module files
35+
#
36+
37+
MOSTLYCLEANFILES = *.mod
38+
39+
#
40+
# Automake doesn't do Fortran dependency analysis, so must list them
41+
# manually here. Bummer!
42+
#
43+
44+
mpi-f08-types.lo: mpi-f08-types.f90
45+
mpi-f08-interfaces.lo: mpi-f08-interfaces.F90 mpi-f08-types.lo
46+
47+
48+
install-exec-hook:
49+
@ for file in `ls *.mod`; do \
50+
echo $(INSTALL) $$file $(DESTDIR)$(libdir); \
51+
$(INSTALL) $$file $(DESTDIR)$(libdir); \
52+
done
53+
54+
uninstall-local:
55+
@ for file in `ls *.mod`; do \
56+
echo rm -f $(DESTDIR)$(libdir)/$$file; \
57+
rm -f $(DESTDIR)$(libdir)/$$file; \
58+
done
59+
60+
else
61+
62+
# Need to have empty targets because AM can't handle having an
63+
# AM_CONDITIONAL was targets in the "if" statement but not in the
64+
# "else". :-(
65+
66+
install-exec-hook:
67+
uninstall-local:
68+
69+
endif

ompi/mpi/fortran/use-mpi-f08-desc/mpi-f08-types.f90 renamed to ompi/mpi/fortran/use-mpi-f08-desc/mod/mpi-f08-types.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
! Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
6-
! Copyright (c) 2015 Research Organization for Information Science
6+
! Copyright (c) 2015-2017 Research Organization for Information Science
77
! and Technology (RIST). All rights reserved.
88
!
99
! This file creates mappings between MPI C types (e.g., MPI_Comm) and
@@ -153,6 +153,6 @@ module mpi_f08_types
153153
!
154154
! STATUS/STATUSES_IGNORE
155155
!
156-
#include "mpif-f08-types.h"
156+
include 'mpif-f08-types.h'
157157

158158
end module mpi_f08_types

ompi/mpi/fortran/use-mpi-f08/Makefile.am

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Copyright (c) 2012-2013 Inria. All rights reserved.
88
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights
99
# reserved.
10-
# Copyright (c) 2015-2016 Research Organization for Information Science
10+
# Copyright (c) 2015-2017 Research Organization for Information Science
1111
# and Technology (RIST). All rights reserved.
1212
# Copyright (c) 2016 IBM Corporation. All rights reserved.
1313
#
@@ -27,7 +27,7 @@ if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
2727
AM_FCFLAGS = -I$(top_builddir)/ompi/include \
2828
-I$(top_srcdir)/ompi/include \
2929
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \
30-
$(OMPI_FC_MODULE_FLAG). \
30+
$(OMPI_FC_MODULE_FLAG)mod \
3131
-I$(top_srcdir) $(FCFLAGS_f90)
3232

3333
MOSTLYCLEANFILES = *.mod
@@ -37,9 +37,7 @@ CLEANFILES += *.i90
3737
lib_LTLIBRARIES = lib@OMPI_LIBMPI_NAME@_usempif08.la
3838

3939
module_sentinel_file = \
40-
libforce_usempif08_internal_modules_to_be_built.la
41-
42-
noinst_LTLIBRARIES = $(module_sentinel_file)
40+
mod/libforce_usempif08_internal_modules_to_be_built.la
4341

4442
mpi-f08.lo: $(module_sentinel_file)
4543
mpi-f08.lo: mpi-f08.F90
@@ -843,41 +841,6 @@ mpi-f08.lo: mpi-f-interfaces-bind.h pmpi-f-interfaces-bind.h
843841

844842
###########################################################################
845843

846-
# f08 support modules
847-
848-
libforce_usempif08_internal_modules_to_be_built_la_SOURCES = \
849-
mpi-f08-types.F90 \
850-
mpi-f08-interfaces.F90 \
851-
mpi-f08-interfaces-callbacks.F90 \
852-
mpi-f08-callbacks.F90 \
853-
pmpi-f08-interfaces.F90
854-
855-
config_h = \
856-
$(top_builddir)/ompi/mpi/fortran/configure-fortran-output.h \
857-
$(top_srcdir)/ompi/mpi/fortran/configure-fortran-output-bottom.h
858-
859-
#
860-
# Automake doesn't do Fortran dependency analysis, so must list them
861-
# manually here. Bummer!
862-
#
863-
864-
mpi-f08-types.lo: $(config_h)
865-
mpi-f08-types.lo: mpi-f08-types.F90
866-
mpi-f08-interfaces.lo: $(config_h)
867-
mpi-f08-interfaces.lo: mpi-f08-interfaces.F90
868-
mpi-f08-interfaces.lo: mpi-f08-interfaces-callbacks.lo
869-
mpi-f08-interfaces-callbacks.lo: $(config_h)
870-
mpi-f08-interfaces-callbacks.lo: mpi-f08-interfaces-callbacks.F90
871-
mpi-f08-interfaces-callbacks.lo: mpi-f08-types.lo
872-
mpi-f08-callbacks.lo: $(config_h)
873-
mpi-f08-callbacks.lo: mpi-f08-callbacks.F90
874-
mpi-f08-callbacks.lo: mpi-f08-types.lo
875-
pmpi-f08-interfaces.lo: $(config_h)
876-
pmpi-f08-interfaces.lo: pmpi-f08-interfaces.F90
877-
pmpi-f08-interfaces.lo: mpi-f08-interfaces-callbacks.lo
878-
879-
###########################################################################
880-
881844
# Install the generated .mod files. Unfortunately, each F90 compiler
882845
# may generate different filenames, so we have to use a glob. :-(
883846

0 commit comments

Comments
 (0)