Skip to content

Commit

Permalink
fortran2008: fix mpiext example
Browse files Browse the repository at this point in the history
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 <gilles@rist.or.jp>
  • Loading branch information
ggouaillardet committed Aug 9, 2017
1 parent 9b43de1 commit 2c71c27
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 56 deletions.
4 changes: 4 additions & 0 deletions config/ompi_config_files.m4
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -32,7 +34,9 @@ AC_DEFUN([OMPI_CONFIG_FILES],[
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-interfaces.h
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h
ompi/mpi/fortran/use-mpi-f08/Makefile
ompi/mpi/fortran/use-mpi-f08/mod/Makefile
ompi/mpi/fortran/use-mpi-f08-desc/Makefile
ompi/mpi/fortran/use-mpi-f08-desc/mod/Makefile
ompi/mpi/fortran/mpiext/Makefile
ompi/mpi/tool/Makefile
ompi/mpi/tool/profile/Makefile
Expand Down
6 changes: 5 additions & 1 deletion config/ompi_setup_mpi_fortran.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dnl Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2014-2016 Research Organization for Information Science
dnl Copyright (c) 2014-2017 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2016 IBM Corporation. All rights reserved.
dnl $COPYRIGHT$
Expand All @@ -35,6 +35,7 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
OMPI_FORTRAN_USEMPI_LIB=

OMPI_FORTRAN_USEMPIF08_DIR=
OMPI_FORTRAN_USEMPIF08_MOD=
OMPI_FORTRAN_USEMPIF08_LIB=

OMPI_FORTRAN_MAX_ARRAY_RANK=0
Expand Down Expand Up @@ -543,12 +544,14 @@ end type test_mpi_handle],
AS_IF([test $OMPI_BUILD_FORTRAN_F08_SUBARRAYS -eq 1],
[ # Case a) partial/prototype implementation
OMPI_FORTRAN_USEMPIF08_DIR=mpi/fortran/use-mpi-f08-desc
OMPI_FORTRAN_USEMPIF08_MOD=$OMPI_FORTRAN_USEMPIF08_DIR/mod
OMPI_FORTRAN_SUBARRAYS_SUPPORTED=.TRUE.
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=0
AC_MSG_RESULT([array subsections (partial/experimental)])
],
[ # Both cases b) and c)
OMPI_FORTRAN_USEMPIF08_DIR=mpi/fortran/use-mpi-f08
OMPI_FORTRAN_USEMPIF08_MOD=$OMPI_FORTRAN_USEMPIF08_DIR/mod
OMPI_FORTRAN_SUBARRAYS_SUPPORTED=.FALSE.
AS_IF([test $OMPI_FORTRAN_HAVE_OPTIONAL_ARGS -eq 1],
[ # Case b) "good compiler"
Expand Down Expand Up @@ -701,6 +704,7 @@ end type test_mpi_handle],

# This goes into ompi/Makefile.am
AC_SUBST(OMPI_FORTRAN_USEMPIF08_DIR)
AC_SUBST(OMPI_FORTRAN_USEMPIF08_MOD)
# This goes into mpifort-wrapper-data.txt
AC_SUBST(OMPI_FORTRAN_USEMPIF08_LIB)

Expand Down
5 changes: 4 additions & 1 deletion ompi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# Copyright (c) 2015-2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# $COPYRIGHT$
Expand Down Expand Up @@ -90,6 +90,7 @@ SUBDIRS = \
mpi/fortran/mpif-h \
$(OMPI_MPIEXT_USEMPI_DIR) \
$(OMPI_FORTRAN_USEMPI_DIR) \
$(OMPI_FORTRAN_USEMPIF08_MOD) \
$(OMPI_MPIEXT_USEMPIF08_DIRS) \
$(OMPI_FORTRAN_USEMPIF08_DIR) \
mpi/fortran/mpiext \
Expand Down Expand Up @@ -119,7 +120,9 @@ DIST_SUBDIRS = \
mpi/fortran/use-mpi-tkr \
mpi/fortran/use-mpi-ignore-tkr \
mpi/fortran/use-mpi-f08 \
mpi/fortran/use-mpi-f08/mod \
mpi/fortran/use-mpi-f08-desc \
mpi/fortran/use-mpi-f08-desc/mod \
mpi/fortran/mpiext \
mpi/java \
$(OMPI_MPIEXT_ALL_SUBDIRS) \
Expand Down
7 changes: 5 additions & 2 deletions ompi/mpi/fortran/mpiext/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -18,6 +20,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT

AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPIF08_MOD) \
-I$(top_srcdir) $(FCFLAGS_f90)

flibs =
Expand Down Expand Up @@ -61,7 +64,7 @@ libforce_usempif08_module_to_be_built_la_SOURCES = mpi-f08-ext-module.F90
# manually here. Bummer!
#

mpi_f08_ext.lo: $(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mpi-f08-types.lo
mpi_f08_ext.lo: $(top_builddir)/ompi/mpi/fortran/use-mpi-f08-modules/mpi-f08-types.lo
mpi_f08_ext.lo: mpi-f08-ext-module.F90
endif

Expand Down
15 changes: 6 additions & 9 deletions ompi/mpi/fortran/use-mpi-f08-desc/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- makefile -*-
#
# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# Copyright (c) 2015-2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
#
Expand All @@ -17,10 +17,12 @@
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS

AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
-I$(top_srcdir) $(FCFLAGS)
-I$(top_srcdir) -Imod $(FCFLAGS)

lib_LTLIBRARIES = lib@OMPI_LIBMPI_NAME@_usempif08.la

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

lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = \
$(mpi_api_files) \
mpi-f08-types.f90 \
mpi-f08-interfaces.F90 \
mpi-f-interfaces-bind.h \
mpi-f08.f90 \
ISO_Fortran_binding.h \
Expand All @@ -59,9 +59,7 @@ MOSTLYCLEANFILES = *.mod
# manually here. Bummer!
#

mpi-f08-types.lo: mpi-f08-types.f90
mpi-f08-interfaces.lo: mpi-f08-interfaces.F90 mpi-f08-types.lo
OMPI_Fortran_binding.lo: OMPI_Fortran_binding.f90 mpi-f08-types.lo
OMPI_Fortran_binding.lo: OMPI_Fortran_binding.f90 mod/mpi-f08-types.lo


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

$(mpi_api_lo_files): mpi-f08.lo

mpi-f08.lo: mpi-f08-types.lo
mpi-f08.lo: $(module_sentinel_file)
mpi-f08.lo: OMPI_Fortran_binding.lo
mpi-f08.lo: mpi-f08-interfaces.lo
mpi-f08.lo: mpi-f-interfaces-bind.h
mpi-f08.lo: mpi-f08.f90

Expand Down
69 changes: 69 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08-desc/mod/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# -*- makefile -*-
#
# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
#
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

# This Makefile is only relevant if we're building the "use mpi_f08"
# MPI bindings.
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS

AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
-I$(top_srcdir) $(FCFLAGS)

module_sentinel_file = \
libforce_usempif08_internal_modules_to_be_built.la

noinst_LTLIBRARIES = $(module_sentinel_file)

# f08 support modules

libforce_usempif08_internal_modules_to_be_built_la_SOURCES = \
mpi-f08-types.f90 \
mpi-f08-interfaces.F90

#
# Clean up all F90 module files
#

MOSTLYCLEANFILES = *.mod

#
# Automake doesn't do Fortran dependency analysis, so must list them
# manually here. Bummer!
#

mpi-f08-types.lo: mpi-f08-types.f90
mpi-f08-interfaces.lo: mpi-f08-interfaces.F90 mpi-f08-types.lo


install-exec-hook:
@ for file in `ls *.mod`; do \
echo $(INSTALL) $$file $(DESTDIR)$(libdir); \
$(INSTALL) $$file $(DESTDIR)$(libdir); \
done

uninstall-local:
@ for file in `ls *.mod`; do \
echo rm -f $(DESTDIR)$(libdir)/$$file; \
rm -f $(DESTDIR)$(libdir)/$$file; \
done

else

# Need to have empty targets because AM can't handle having an
# AM_CONDITIONAL was targets in the "if" statement but not in the
# "else". :-(

install-exec-hook:
uninstall-local:

endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
! Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
! All rights reserved.
! Copyright (c) 2015 Research Organization for Information Science
! Copyright (c) 2015-2017 Research Organization for Information Science
! and Technology (RIST). All rights reserved.
!
! This file creates mappings between MPI C types (e.g., MPI_Comm) and
Expand Down Expand Up @@ -153,6 +153,6 @@ module mpi_f08_types
!
! STATUS/STATUSES_IGNORE
!
#include "mpif-f08-types.h"
include 'mpif-f08-types.h'

end module mpi_f08_types
43 changes: 3 additions & 40 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (c) 2012-2013 Inria. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2015-2016 Research Organization for Information Science
# Copyright (c) 2015-2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
#
Expand All @@ -27,7 +27,7 @@ if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
AM_FCFLAGS = -I$(top_builddir)/ompi/include \
-I$(top_srcdir)/ompi/include \
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \
$(OMPI_FC_MODULE_FLAG). \
$(OMPI_FC_MODULE_FLAG)mod \
-I$(top_srcdir) $(FCFLAGS_f90)

MOSTLYCLEANFILES = *.mod
Expand All @@ -37,9 +37,7 @@ CLEANFILES += *.i90
lib_LTLIBRARIES = lib@OMPI_LIBMPI_NAME@_usempif08.la

module_sentinel_file = \
libforce_usempif08_internal_modules_to_be_built.la

noinst_LTLIBRARIES = $(module_sentinel_file)
mod/libforce_usempif08_internal_modules_to_be_built.la

mpi-f08.lo: $(module_sentinel_file)
mpi-f08.lo: mpi-f08.F90
Expand Down Expand Up @@ -843,41 +841,6 @@ mpi-f08.lo: mpi-f-interfaces-bind.h pmpi-f-interfaces-bind.h

###########################################################################

# f08 support modules

libforce_usempif08_internal_modules_to_be_built_la_SOURCES = \
mpi-f08-types.F90 \
mpi-f08-interfaces.F90 \
mpi-f08-interfaces-callbacks.F90 \
mpi-f08-callbacks.F90 \
pmpi-f08-interfaces.F90

config_h = \
$(top_builddir)/ompi/mpi/fortran/configure-fortran-output.h \
$(top_srcdir)/ompi/mpi/fortran/configure-fortran-output-bottom.h

#
# Automake doesn't do Fortran dependency analysis, so must list them
# manually here. Bummer!
#

mpi-f08-types.lo: $(config_h)
mpi-f08-types.lo: mpi-f08-types.F90
mpi-f08-interfaces.lo: $(config_h)
mpi-f08-interfaces.lo: mpi-f08-interfaces.F90
mpi-f08-interfaces.lo: mpi-f08-interfaces-callbacks.lo
mpi-f08-interfaces-callbacks.lo: $(config_h)
mpi-f08-interfaces-callbacks.lo: mpi-f08-interfaces-callbacks.F90
mpi-f08-interfaces-callbacks.lo: mpi-f08-types.lo
mpi-f08-callbacks.lo: $(config_h)
mpi-f08-callbacks.lo: mpi-f08-callbacks.F90
mpi-f08-callbacks.lo: mpi-f08-types.lo
pmpi-f08-interfaces.lo: $(config_h)
pmpi-f08-interfaces.lo: pmpi-f08-interfaces.F90
pmpi-f08-interfaces.lo: mpi-f08-interfaces-callbacks.lo

###########################################################################

# Install the generated .mod files. Unfortunately, each F90 compiler
# may generate different filenames, so we have to use a glob. :-(

Expand Down
Loading

0 comments on commit 2c71c27

Please sign in to comment.