From b380dd58b5ccb849f1a742d765244b2029164e36 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Thu, 20 Dec 2018 22:48:50 +0900 Subject: [PATCH] config/ompi_ext: use mpi module in mpi_ext module If MPI extensions are enabled, all `ompi/mpiext/pcollreq/use-mpi/mpiext_*_usempi.h` are included in `ompi/mpi/fortran/mpiext-use-mpi/mpi-ext-module.F90` and all `ompi/mpiext/pcollreq/use-mpi/mpiext_*_usempif08.h` are included in `ompi/mpi/fortran/mpiext-use-mpi-f08/mpi-f08-ext-module.F90` using `#include` directives. In `mpiext_*_usempi.h` and `mpiext_*_usempif08.h`, some MPI extension may want to use constants or handles defined in the `mpi` module and the `mpi_f08` module. For example, if you want to define a new datatype in `mpi_f08_ext`, you'll need the definition of `type(mpi_datatype)`. However, putting `use mpi_f08` line in thier `mpiext_*_usempif08.h` may cause a compilation error if more than one MPI extensions are enabled because the `use` statement must be put prior to any variable declarations. To resolve this problem, this commit puts `use mpi` and `use mpi_f08` as first lines of `mpi-ext-module.F90` and `mpi-f08-ext-module.F90` respectively. Signed-off-by: KAWASHIMA Takahiro --- config/ompi_ext.m4 | 6 ++++++ ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am | 1 + ompi/mpi/fortran/mpiext-use-mpi/Makefile.am | 1 + 3 files changed, 8 insertions(+) diff --git a/config/ompi_ext.m4 b/config/ompi_ext.m4 index 82f2687013..a30bcdb3c9 100644 --- a/config/ompi_ext.m4 +++ b/config/ompi_ext.m4 @@ -171,6 +171,9 @@ EOF #include "ompi/mpi/fortran/configure-fortran-output.h" module mpi_ext +! Some mpi_ext extensions may require the mpi module. + use mpi +! ! Even though this is not a useful parameter (cannot be used as a ! preprocessor catch) define it to keep the linker from complaining ! during the build. @@ -213,6 +216,9 @@ EOF #include "ompi/mpi/fortran/configure-fortran-output.h" module mpi_f08_ext +! Some mpi_f08_ext extensions may require the mpi_f08 module. + use mpi_f08 +! ! Even though this is not a useful parameter (cannot be used as a ! preprocessor catch) define it to keep the linker from complaining ! during the build. diff --git a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am index d5326b2c54..616982611a 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am @@ -22,6 +22,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/mpi/fortran/use-mpi-f08/mod \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08 \ -I$(top_srcdir) $(FCFLAGS_f90) flibs = diff --git a/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am index 944add7bc1..b8318ce93c 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am @@ -21,6 +21,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/mpi/fortran/use-mpi-ignore-tkr \ -I$(top_srcdir) $(FCFLAGS_f90) flibs =