diff --git a/.gitignore b/.gitignore index 089d60d9614..565c3299987 100644 --- a/.gitignore +++ b/.gitignore @@ -190,7 +190,6 @@ ompi/include/mpif-c-constants.h ompi/include/mpif-common.h ompi/include/mpi-ext.h ompi/include/mpif-ext.h -ompi/include/mpif-f08-types.h ompi/include/mpif-handles.h ompi/include/mpif-io-constants.h ompi/include/mpif-constants.h diff --git a/config/ompi_fortran_check_ignore_tkr.m4 b/config/ompi_fortran_check_ignore_tkr.m4 index bb64eb50565..4e2ea7a6c51 100644 --- a/config/ompi_fortran_check_ignore_tkr.m4 +++ b/config/ompi_fortran_check_ignore_tkr.m4 @@ -13,7 +13,7 @@ dnl All rights reserved. dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2009-2022 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -72,7 +72,7 @@ AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [ # Vendor-neutral, TYPE(*) syntax OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB( - [!], [type(*)], + [!], [type(*), dimension(*)], [TYPE(*), DIMENSION(*)], [happy=1], [happy=0]) @@ -185,7 +185,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [ subroutine force_assumed_shape(a, count) integer :: count - real, dimension(:,:) :: a + complex, dimension(:,:) :: a call foo(a, count) end subroutine force_assumed_shape diff --git a/config/ompi_fortran_check_use_only.m4 b/config/ompi_fortran_check_use_only.m4 index c147167391d..c95c0f1db91 100644 --- a/config/ompi_fortran_check_use_only.m4 +++ b/config/ompi_fortran_check_use_only.m4 @@ -42,14 +42,19 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_USE_ONLY],[ [AC_LANG_PUSH([Fortran]) cat > aaa.f90 << EOF MODULE aaa -INTEGER :: CMON(1) -COMMON/CMMON/CMON +! These 2 have the same names as variables in bbb +! but they should not clash if we only import global_aaa +INTEGER :: local1 +REAL :: local2 INTEGER :: global_aaa END MODULE aaa EOF cat > bbb.f90 << EOF MODULE bbb -integer, bind(C, name="cmmon_") :: CMON +! These 2 have the same names as variables in aaa +! but they should not clash if we only import global_bbb +INTEGER :: local1 +COMPLEX :: local2 INTEGER :: global_bbb END MODULE bbb EOF diff --git a/config/ompi_fortran_get_alignment.m4 b/config/ompi_fortran_get_alignment.m4 index 141e062d5d7..578d0f701fc 100644 --- a/config/ompi_fortran_get_alignment.m4 +++ b/config/ompi_fortran_get_alignment.m4 @@ -136,44 +136,78 @@ EOF # OMPI_FORTRAN_F08_GET_HANDLE_ALIGNMENT(type, variable to set) # ------------------------------------------ AC_DEFUN([OMPI_FORTRAN_F08_GET_HANDLE_ALIGNMENT],[ + unset happy + OPAL_VAR_SCOPE_PUSH([happy ompi_conftest_h]) + # Use of m4_translit suggested by Eric Blake: # http://lists.gnu.org/archive/html/bug-autoconf/2010-10/msg00016.html AS_VAR_PUSHDEF([type_var], m4_translit([[ompi_cv_fortran_alignment_$1]], [*], [p])) AC_CACHE_CHECK([alignment of Fortran $1], type_var, - [AC_LANG_PUSH([Fortran]) - AC_LINK_IFELSE([AC_LANG_SOURCE([[module alignment_mod -type, BIND(C) :: test_mpi_handle - integer :: MPI_VAL -end type test_mpi_handle -type(test_mpi_handle) :: t1 -type(test_mpi_handle) :: t2 -end module - -program falignment - use alignment_mod - OPEN(UNIT=10, FILE="conftestval") - if (LOC(t1) > LOC(t2)) then - write (10,'(I5)') LOC(t1)-LOC(t2) - else - write (10,'(I5)') LOC(t2)-LOC(t1) - endif - CLOSE(10) - -end program]])], - [AS_IF([test "$cross_compiling" = "yes"], - [AC_MSG_ERROR([Can not determine alignment of $1 when cross-compiling])], - [OPAL_LOG_COMMAND([./conftest], - [AS_VAR_SET(type_var, [`cat conftestval`])], - [AC_MSG_ERROR([Could not determine alignment of $1])])])], - - [AC_MSG_WARN([Could not determine alignment of $1]) - AC_MSG_WARN([See config.log for details]) - AC_MSG_ERROR([Cannot continue])]) - rm -rf conftest* *.mod 2> /dev/null - AC_LANG_POP([Fortran])]) + [OMPI_FORTRAN_MAKE_C_FUNCTION([ompi_ac_align_fn], [align]) + # Fortran module + cat > conftestf.f < conftest.c < +#include + +void $ompi_ac_align_fn(char *w, char *x, char *y, char *z) +{ + unsigned long aw, ax, ay, az; + FILE *f = fopen("conftestval", "w"); + if (!f) exit(1); + aw = (unsigned long) w; + ax = (unsigned long) x; + ay = (unsigned long) y; + az = (unsigned long) z; + if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) fprintf(f, "%d\n", 16); + else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) fprintf(f, "%d\n", 12); + else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) fprintf(f, "%d\n", 8); + else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) fprintf(f, "%d\n", 4); + else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) fprintf(f, "%d\n", 2); + else fprintf(f, "%d\n", 1); + fclose(f); +} +EOF + + OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c], + [OPAL_LOG_COMMAND([$FC $FCFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS], + [happy="yes"], [happy="no"])], [happy="no"]) + + if test "$happy" = "no" ; then + AC_MSG_RESULT([Error!]) + AC_MSG_ERROR([Could not determine alignment of $1]) + fi + + AS_IF([test "$cross_compiling" = "yes"], + [AC_MSG_RESULT([Error!]) + AC_MSG_ERROR([Can not determine alignment of $1 when cross-compiling])], + [OPAL_LOG_COMMAND([./conftest], + [AS_VAR_SET(type_var, [`cat conftestval`])], + [AC_MSG_RESULT([Error!]) + AC_MSG_ERROR([Could not determine alignment of $1])])]) + rm -rf conftest*]) AS_VAR_COPY([$2], [type_var]) AS_VAR_POPDEF([type_var])dnl + OPAL_VAR_SCOPE_POP ])dnl diff --git a/ompi/include/Makefile.am b/ompi/include/Makefile.am index 222ec75bbbc..2122d04a4dc 100644 --- a/ompi/include/Makefile.am +++ b/ompi/include/Makefile.am @@ -41,7 +41,8 @@ include_HEADERS += \ mpif-handles.h \ mpif-io-constants.h \ mpif-io-handles.h \ - mpif-sentinels.h + mpif-sentinels.h \ + mpif-status.h endif @@ -125,7 +126,7 @@ CLEANFILES = mpif-sizeof.f90 distclean-local: rm -f mpi-ext.h mpif-ext.h mpi_portable_platform.h \ mpif-sizeof.h \ - mpif-c-constants-decl.h mpif-c-constants.h mpif-f08-types.h + mpif-c-constants-decl.h mpif-c-constants.h mpi_portable_platform.h: $(top_srcdir)/opal/include/opal/opal_portable_platform_real.h -@rm -f mpi_portable_platform.h diff --git a/ompi/include/mpif-sentinels.h b/ompi/include/mpif-sentinels.h index 082154cdbbc..c194c68d0c0 100644 --- a/ompi/include/mpif-sentinels.h +++ b/ompi/include/mpif-sentinels.h @@ -33,14 +33,26 @@ ! that we already have overloaded F90 bindings for all available ! types), so any type is fine. integer MPI_BOTTOM + common/mpi_fortran_bottom/MPI_BOTTOM + bind(C, name="mpi_fortran_bottom")/mpi_fortran_bottom/ + ! MPI_IN_PLACE has the same rationale as MPI_BOTTOM. integer MPI_IN_PLACE + common/mpi_fortran_in_place/MPI_IN_PLACE + bind(C, name="mpi_fortran_in_place")/mpi_fortran_in_place/ + ! Making MPI_ARGV_NULL be the same type as the parameter that is ! exepected in the F90 binding for MPI_COMM_SPAWN means that we ! don't need another interface for MPI_COMM_SPAWN. character MPI_ARGV_NULL(1) + common/mpi_fortran_argv_null/MPI_ARGV_NULL + bind(C, name="mpi_fortran_argv_null")/mpi_fortran_argv_null/ + ! Ditto for MPI_ARGVS_NULL / MPI_COMM_SPAWN_MULTIPLE. character MPI_ARGVS_NULL(1, 1) + common/mpi_fortran_argvs_null/MPI_ARGVS_NULL + bind(C, name="mpi_fortran_argvs_null")/mpi_fortran_argvs_null/ + ! MPI_ERRCODES_IGNORE has similar rationale to MPI_ARGV_NULL. The ! F77 functions are all smart enough to check that the errcodes ! parameter is not ERRCODES_IGNORE before assigning values into it @@ -48,21 +60,15 @@ ! matter -- we'll never overrun it because we never assign values ! into it). integer MPI_ERRCODES_IGNORE(1) -! MPI_STATUS_IGNORE has similar rationale to MPI_ERRCODES_IGNORE. - integer MPI_STATUS_IGNORE(MPI_STATUS_SIZE) -! Ditto for MPI_STATUSES_IGNORE - integer MPI_STATUSES_IGNORE(MPI_STATUS_SIZE, 1) + common/mpi_fortran_errc_ign/MPI_ERRCODES_IGNORE + bind(C, name="mpi_fortran_errcodes_ignore")/mpi_fortran_errc_ign/ + ! Ditto for MPI_UNWEIGHTED integer MPI_UNWEIGHTED(1) + common/mpi_fortran_unwghtd/MPI_UNWEIGHTED + bind(C, name="mpi_fortran_unweighted")/mpi_fortran_unwghtd/ + ! Ditto for MPI_WEIGHTS_EMPTY integer MPI_WEIGHTS_EMPTY(1) - - common/mpi_fortran_bottom/MPI_BOTTOM - common/mpi_fortran_in_place/MPI_IN_PLACE - common/mpi_fortran_argv_null/MPI_ARGV_NULL - common/mpi_fortran_argvs_null/MPI_ARGVS_NULL - common/mpi_fortran_errcodes_ignore/MPI_ERRCODES_IGNORE - common/mpi_fortran_status_ignore/MPI_STATUS_IGNORE - common/mpi_fortran_statuses_ignore/MPI_STATUSES_IGNORE - common/mpi_fortran_unweighted/MPI_UNWEIGHTED - common/mpi_fortran_weights_empty/MPI_WEIGHTS_EMPTY + common/mpi_fortran_wghts_empty/MPI_WEIGHTS_EMPTY + bind(C, name="mpi_fortran_weights_empty")/mpi_fortran_wghts_empty/ diff --git a/ompi/include/mpif-status.h b/ompi/include/mpif-status.h new file mode 100644 index 00000000000..e7318490877 --- /dev/null +++ b/ompi/include/mpif-status.h @@ -0,0 +1,29 @@ +! -*- fortran -*- +! +! Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana +! University Research and Technology +! Corporation. All rights reserved. +! Copyright (c) 2004-2005 The University of Tennessee and The University +! of Tennessee Research Foundation. All rights +! reserved. +! Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +! University of Stuttgart. All rights reserved. +! Copyright (c) 2004-2005 The Regents of the University of California. +! All rights reserved. +! Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ +! + + ! MPI_STATUS[ES]_IGNORE are also sentinels, but they are different + ! types than they are in mpi_f08. + integer MPI_STATUS_IGNORE(MPI_STATUS_SIZE) + common/mpi_fortran_st_ign/MPI_STATUS_IGNORE + bind(C, name="mpi_fortran_status_ignore")/mpi_fortran_st_ign/ + + integer MPI_STATUSES_IGNORE(MPI_STATUS_SIZE, 1) + common/mpi_fortran_sts_ign/MPI_STATUSES_IGNORE + bind(C, name="mpi_fortran_statuses_ignore")/mpi_fortran_sts_ign/ diff --git a/ompi/include/mpif.h.in b/ompi/include/mpif.h.in index d4cbd138325..49aef70e0c2 100644 --- a/ompi/include/mpif.h.in +++ b/ompi/include/mpif.h.in @@ -61,3 +61,4 @@ include 'mpif-externals.h' include 'mpif-sentinels.h' include 'mpif-sizeof.h' + include 'mpif-status.h' diff --git a/ompi/mpi/fortran/base/gen-mpi-mangling.pl b/ompi/mpi/fortran/base/gen-mpi-mangling.pl index a049c625228..a359e332c65 100755 --- a/ompi/mpi/fortran/base/gen-mpi-mangling.pl +++ b/ompi/mpi/fortran/base/gen-mpi-mangling.pl @@ -32,14 +32,12 @@ my $file_c_constants_decl = "mpif-c-constants-decl.h"; my $file_c_constants = "mpif-c-constants.h"; -my $file_f08_types = "mpif-f08-types.h"; # If we are not building fortran, then just make empty files if ($caps_arg + $plain_arg + $single_underscore_arg + $double_underscore_arg == 0) { system("touch $file_c_constants_decl"); system("touch $file_c_constants"); - system("touch $file_f08_types"); exit(0); } @@ -108,22 +106,6 @@ ############################################################### -sub mangle { - my $name = shift; - - if ($plain_arg) { - return $name; - } elsif ($caps_arg) { - return uc($name); - } elsif ($single_underscore_arg) { - return $name . "_"; - } elsif ($double_underscore_arg) { - return $name . "__"; - } else { - die "Unknown name mangling type"; - } -} - sub gen_c_constants_decl { open(OUT, ">$file_c_constants_decl") || die "Can't write to $file_c_constants_decl"; @@ -139,13 +121,13 @@ sub gen_c_constants_decl { */ /* Note that the rationale for the types of each of these variables is - discussed in ompi/include/mpif-common.h. Do not change the types + discussed in ompi/include/mpif-sentinels.h. Do not change the types without also changing ompi/runtime/ompi_mpi_init.c and - ompi/include/mpif-common.h. */\n\n"; + ompi/include/mpif-sentinels.h. */\n\n"; foreach my $key (sort(keys(%{$fortran}))) { my $f = $fortran->{$key}; - my $m = mangle($f->{c_name}); + my $m = $f->{c_name}; print OUT "extern $f->{c_type} $m; #define OMPI_IS_FORTRAN_" . uc($key) . "(addr) \\ (addr == (void*) &$m)\n\n"; @@ -170,30 +152,8 @@ sub gen_c_constants { foreach my $key (sort(keys(%{$fortran}))) { my $f = $fortran->{$key}; - my $m = mangle($f->{c_name}); - print OUT "$f->{c_type} $m;\n"; - } - - close (OUT); -} - -sub gen_f08_types { - open(OUT, ">$file_f08_types") || - die "Can't write to $file_f08_types"; - - print OUT "! WARNING: This is a generated file! Edits will be lost! */ -! -! Copyright (c) 2015 Research Organization for Information Science -! and Technology (RIST). All rights reserved. -! Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. -! \$COPYRIGHT\$ -! -! This file was generated by gen-mpi-mangling.pl -!\n\n"; - - foreach my $key (sort(keys(%{$fortran}))) { - my $f = $fortran->{$key}; - print OUT "$f->{f_type}, bind(C, name=\"".mangle($f->{c_name})."\") :: $f->{f_name}\n"; + my $m = $f->{c_name}; + print OUT "$f->{c_type} $m = {0};\n"; } close (OUT); @@ -201,6 +161,5 @@ sub gen_f08_types { gen_c_constants_decl(); gen_c_constants(); -gen_f08_types(); exit(0); diff --git a/ompi/mpi/fortran/base/gen-mpi-sizeof.pl b/ompi/mpi/fortran/base/gen-mpi-sizeof.pl index 30b1d3446c1..aa11f4e88f0 100755 --- a/ompi/mpi/fortran/base/gen-mpi-sizeof.pl +++ b/ompi/mpi/fortran/base/gen-mpi-sizeof.pl @@ -72,9 +72,11 @@ ############################################################################# +my $optional_name_modifier; my $optional_ierror_param; my $optional_ierror_statement; if (lc($ierror_arg) eq "optional") { + $optional_name_modifier = "_opt"; $optional_ierror_param = ", OPTIONAL"; $optional_ierror_statement = "IF (present(ierror)) "; } @@ -89,7 +91,7 @@ sub queue_sub { my ($f_type, $suffix, $import_type) = @_; # Leave off the MPI/PMI prefix; we'll add that when outputting - my $sub_name = "Sizeof_$suffix"; + my $sub_name = "Sizeof_$suffix$optional_name_modifier"; # Make a hash for this subroutine my $subr; diff --git a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am index 5e5312f6e2d..98a3e92da76 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am @@ -29,6 +29,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 \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(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) -I$(top_builddir) $(FCFLAGS_f90) diff --git a/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h b/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h index a1a0bf602cd..e25152b9ba7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h +++ b/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h @@ -3679,7 +3679,6 @@ end subroutine ompi_mrecv_f subroutine ompi_neighbor_allgather_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & comm,ierror) & BIND(C, name="ompi_neighbor_allgather_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3692,7 +3691,6 @@ end subroutine ompi_neighbor_allgather_f subroutine ompi_ineighbor_allgather_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & comm,request,ierror) & BIND(C, name="ompi_ineighbor_allgather_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: recvbuf @@ -3706,7 +3704,6 @@ end subroutine ompi_ineighbor_allgather_f subroutine ompi_neighbor_allgather_init_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & comm,info,request,ierror) & BIND(C, name="ompi_neighbor_allgather_init_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3721,7 +3718,6 @@ end subroutine ompi_neighbor_allgather_init_f subroutine ompi_neighbor_allgatherv_f(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs, & recvtype,comm,ierror) & BIND(C, name="ompi_neighbor_allgatherv_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3735,7 +3731,6 @@ end subroutine ompi_neighbor_allgatherv_f subroutine ompi_ineighbor_allgatherv_f(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs, & recvtype,comm,request,ierror) & BIND(C, name="ompi_ineighbor_allgatherv_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: recvbuf @@ -3750,7 +3745,6 @@ end subroutine ompi_ineighbor_allgatherv_f subroutine ompi_neighbor_allgatherv_init_f(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs, & recvtype,comm,info,request,ierror) & BIND(C, name="ompi_neighbor_allgatherv_init_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3766,7 +3760,6 @@ end subroutine ompi_neighbor_allgatherv_init_f subroutine ompi_neighbor_alltoall_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & comm,ierror) & BIND(C, name="ompi_neighbor_alltoall_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3779,7 +3772,6 @@ end subroutine ompi_neighbor_alltoall_f subroutine ompi_ineighbor_alltoall_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & comm,request,ierror) & BIND(C, name="ompi_ineighbor_alltoall_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: recvbuf @@ -3793,7 +3785,6 @@ end subroutine ompi_ineighbor_alltoall_f subroutine ompi_neighbor_alltoall_init_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & comm,info,request,ierror) & BIND(C, name="ompi_neighbor_alltoall_init_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3808,7 +3799,6 @@ end subroutine ompi_neighbor_alltoall_init_f subroutine ompi_neighbor_alltoallv_f(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvcounts, & rdispls,recvtype,comm,ierror) & BIND(C, name="ompi_neighbor_alltoallv_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3821,7 +3811,6 @@ end subroutine ompi_neighbor_alltoallv_f subroutine ompi_ineighbor_alltoallv_f(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvcounts, & rdispls,recvtype,comm,request,ierror) & BIND(C, name="ompi_ineighbor_alltoallv_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: recvbuf @@ -3835,7 +3824,6 @@ end subroutine ompi_ineighbor_alltoallv_f subroutine ompi_neighbor_alltoallv_init_f(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvcounts, & rdispls,recvtype,comm,info,request,ierror) & BIND(C, name="ompi_neighbor_alltoallv_init_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3850,7 +3838,7 @@ end subroutine ompi_neighbor_alltoallv_init_f subroutine ompi_neighbor_alltoallw_f(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recvcounts, & rdispls,recvtypes,comm,ierror) & BIND(C, name="ompi_neighbor_alltoallw_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_ADDRESS_KIND implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf @@ -3864,7 +3852,7 @@ end subroutine ompi_neighbor_alltoallw_f subroutine ompi_ineighbor_alltoallw_f(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recvcounts, & rdispls,recvtypes,comm,request,ierror) & BIND(C, name="ompi_ineighbor_alltoallw_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_ADDRESS_KIND implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: recvbuf @@ -3879,7 +3867,7 @@ end subroutine ompi_ineighbor_alltoallw_f subroutine ompi_neighbor_alltoallw_init_f(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recvcounts, & rdispls,recvtypes,comm,info,request,ierror) & BIND(C, name="ompi_neighbor_alltoallw_init_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_ADDRESS_KIND implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 index 3b7dad61b75..dc6e0b98af6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 @@ -10,7 +10,7 @@ #include "mpi-f08-rename.h" subroutine MPI_Comm_get_name_f08(comm,comm_name,resultlen,ierror) - use :: mpi_f08_types, only : MPI_Comm, MPI_MAX_OBJECT_NAME + use :: mpi_f08_types, only : MPI_Comm use :: ompi_mpifh_bindings, only : ompi_comm_get_name_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am index 87f1c2db8ba..8e813d071a6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am @@ -52,7 +52,8 @@ noinst_LTLIBRARIES = libusempif08_internal_modules.la libforce_usempif08_interna libusempif08_internal_modules_la_SOURCES = \ mpi-f08-types.F90 \ mpi-f08-callbacks.F90 \ - mpi-f08-constants.h + mpi-f08-constants.h \ + mpi-f08-sentinels.F90 libusempif08_internal_modules_la_LIBADD = \ $(top_builddir)/ompi/mpi/fortran/use-mpi/libusempi_internal_modules.la diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90 b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90 index 2bbd07eb5f9..a356c7551ec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90 @@ -21,26 +21,8 @@ module mpi_f08_interfaces -#include "mpi-f08-interfaces.h" - -! MPI_Wtick is not a wrapper function -! -interface MPI_Wtick -function MPI_Wtick_f08( ) BIND(C,name="MPI_Wtick") - use, intrinsic :: ISO_C_BINDING - implicit none - DOUBLE PRECISION :: MPI_Wtick_f08 -end function MPI_Wtick_f08 -end interface MPI_Wtick + use :: mpi, only : MPI_Wtick, MPI_Wtime -! MPI_Wtime is not a wrapper function -! -interface MPI_Wtime -function MPI_Wtime_f08( ) BIND(C,name="MPI_Wtime") - use, intrinsic :: ISO_C_BINDING - implicit none - DOUBLE PRECISION :: MPI_Wtime_f08 -end function MPI_Wtime_f08 -end interface MPI_Wtime +#include "mpi-f08-interfaces.h" end module mpi_f08_interfaces diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in index b283a6aa9ba..ab6403dc6bf 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in +++ b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in @@ -812,7 +812,7 @@ end interface MPI_Type_get_extent interface MPI_Type_get_extent_x subroutine MPI_Type_get_extent_x_f08(datatype,lb,extent,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND, MPI_COUNT_KIND + use :: mpi_f08_types, only : MPI_Datatype, MPI_COUNT_KIND implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_COUNT_KIND), INTENT(OUT) :: lb, extent @@ -832,7 +832,7 @@ end interface MPI_Type_get_true_extent interface MPI_Type_get_true_extent_x subroutine MPI_Type_get_true_extent_x_f08(datatype,true_lb,true_extent,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND, MPI_COUNT_KIND + use :: mpi_f08_types, only : MPI_Datatype, MPI_COUNT_KIND implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_COUNT_KIND), INTENT(OUT) :: true_lb, true_extent @@ -2587,7 +2587,7 @@ end interface MPI_Graph_neighbors_count interface MPI_Topo_test subroutine MPI_Topo_test_f08(comm,status,ierror) - use :: mpi_f08_types, only : MPI_Comm, MPI_Status + use :: mpi_f08_types, only : MPI_Comm implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: status @@ -3294,7 +3294,7 @@ end interface MPI_Compare_and_swap interface MPI_Win_complete subroutine MPI_Win_complete_f08(win,ierror) - use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_Win implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror @@ -3341,7 +3341,7 @@ end interface MPI_Win_attach interface MPI_Win_detach subroutine MPI_Win_detach_f08(win,base,ierror) - use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_Win implicit none @OMPI_FORTRAN_IGNORE_TKR_PREDECL@ base @OMPI_FORTRAN_IGNORE_TKR_TYPE@ OMPI_ASYNCHRONOUS :: base @@ -3437,7 +3437,7 @@ end interface MPI_Win_start interface MPI_Win_sync subroutine MPI_Win_sync_f08(win,ierror) - use :: mpi_f08_types, only : MPI_Group, MPI_Win + use :: mpi_f08_types, only : MPI_Win implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-sentinels.F90 b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-sentinels.F90 new file mode 100644 index 00000000000..3407fab1298 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-sentinels.F90 @@ -0,0 +1,36 @@ +! -*- f90 -*- +! +! Copyright (c) 2009-2022 Cisco Systems, Inc. All rights reserved +! Copyright (c) 2009-2012 Los Alamos National Security, LLC. +! All rights reserved. +! Copyright (c) 2015-2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. +! Copyright (c) 2020 The University of Tennessee and The University +! of Tennessee Research Foundation. All rights +! reserved. +! $COPYRIGHT$ +! + +module mpi_f08_sentinels + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Do NOT "use mpi" in here! You will get conflicts for things that + ! are different types (e.g., MPI_STATUS[ES]_IGNORE). + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + use, intrinsic :: ISO_C_BINDING + + use mpi_types + use mpi_sentinels + + ! These are different types than they are in the mpi module + type(MPI_Status) MPI_STATUS_IGNORE + common/mpi_f08_st_ign/MPI_STATUS_IGNORE + bind(C, name="mpi_f08_status_ignore")/mpi_f08_st_ign/ + + type(MPI_Status) MPI_STATUSES_IGNORE(1) + common/mpi_f08_sts_ign/MPI_STATUSES_IGNORE + bind(C, name="mpi_f08_statuses_ignore")/mpi_f08_sts_ign/ + +end module mpi_f08_sentinels diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 index f91a800917c..7f92d67093f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 @@ -20,9 +20,17 @@ module mpi_f08_types + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Do NOT "use mpi" in here! You will get conflicts for things that + ! are different types (e.g., MPI_STATUS[ES]_IGNORE). + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + use, intrinsic :: ISO_C_BINDING use mpi_types + ! Use the same constants that are BIND(C)'ed in the mpi module + use :: mpi, only : MPI_ARGV_NULL, MPI_ARGVS_NULL, MPI_BOTTOM, MPI_ERRCODES_IGNORE, MPI_IN_PLACE, MPI_STATUS_IGNORE, MPI_STATUS_IGNORE, MPI_STATUSES_IGNORE, MPI_UNWEIGHTED, MPI_WEIGHTS_EMPTY + include "mpif-config.h" include "mpif-constants.h" include "mpif-io-constants.h" @@ -158,8 +166,4 @@ module mpi_f08_types type(MPI_Datatype), parameter :: MPI_OFFSET = MPI_Datatype(OMPI_MPI_OFFSET) type(MPI_Datatype), parameter :: MPI_COMPLEX4 = MPI_Datatype(OMPI_MPI_COMPLEX4) -!... Special sentinel constants -!------------------------------ -#include "mpif-f08-types.h" - end module mpi_f08_types diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90 b/ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90 index ddd81d17f74..8cc4ac52235 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90 @@ -25,26 +25,8 @@ module pmpi_f08_interfaces -#include "mpi-f08-interfaces.h" - -! MPI_Wtick is not a wrapper function -! -interface PMPI_Wtick -function PMPI_Wtick_f08( ) BIND(C,name="PMPI_Wtick") - use, intrinsic :: ISO_C_BINDING - implicit none - DOUBLE PRECISION :: PMPI_Wtick_f08 -end function PMPI_Wtick_f08 -end interface PMPI_Wtick + use :: mpi, only : PMPI_Wtick, PMPI_Wtime -! MPI_Wtime is not a wrapper function -! -interface PMPI_Wtime -function PMPI_Wtime_f08( ) BIND(C,name="PMPI_Wtime") - use, intrinsic :: ISO_C_BINDING - implicit none - DOUBLE PRECISION :: PMPI_Wtime_f08 -end function PMPI_Wtime_f08 -end interface PMPI_Wtime +#include "mpi-f08-interfaces.h" end module pmpi_f08_interfaces diff --git a/ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 b/ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 index 89054d8d30e..1da931c7a16 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 @@ -27,6 +27,7 @@ module mpi_f08 use mpi_f08_types + use mpi_f08_sentinels use mpi_f08_interfaces ! this module contains the mpi_f08 interface declarations use pmpi_f08_interfaces ! this module contains the pmpi_f08 interface declarations use mpi_f08_callbacks ! this module contains the mpi_f08 attribute callback subroutines diff --git a/ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 index 954fa8feea4..d5cfb18e4e0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 @@ -10,7 +10,7 @@ #include "mpi-f08-rename.h" subroutine MPI_Topo_test_f08(comm,status,ierror) - use :: mpi_f08_types, only : MPI_Comm, MPI_Status + use :: mpi_f08_types, only : MPI_Comm use :: ompi_mpifh_bindings, only : ompi_topo_test_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 index 9d805a4ba7c..54c5f20b978 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 @@ -11,7 +11,7 @@ subroutine MPI_Type_get_envelope_f08(datatype,num_integers,num_addresses, & num_datatypes,combiner,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_Datatype use :: ompi_mpifh_bindings, only : ompi_type_get_envelope_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 index aa497219c5f..6d2bcd78aec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 @@ -10,7 +10,7 @@ #include "mpi-f08-rename.h" subroutine MPI_Type_get_extent_x_f08(datatype,lb,extent,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND, MPI_COUNT_KIND + use :: mpi_f08_types, only : MPI_Datatype, MPI_COUNT_KIND use :: ompi_mpifh_bindings, only : ompi_type_get_extent_x_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 index 5828adca60a..903e30c7f77 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 @@ -10,7 +10,7 @@ #include "mpi-f08-rename.h" subroutine MPI_Type_get_name_f08(datatype,type_name,resultlen,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_MAX_OBJECT_NAME + use :: mpi_f08_types, only : MPI_Datatype use :: ompi_mpifh_bindings, only : ompi_type_get_name_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 index aa00a66d652..b61e85c134a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 @@ -10,7 +10,7 @@ #include "mpi-f08-rename.h" subroutine MPI_Type_get_true_extent_x_f08(datatype,true_lb,true_extent,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND, MPI_COUNT_KIND + use :: mpi_f08_types, only : MPI_Datatype, MPI_COUNT_KIND use :: ompi_mpifh_bindings, only : ompi_type_get_true_extent_x_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 index 813665ce6c1..baab0f9dedf 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 @@ -11,7 +11,7 @@ subroutine MPI_Type_indexed_f08(count,array_of_blocklengths, & array_of_displacements,oldtype,newtype,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_Datatype use :: ompi_mpifh_bindings, only : ompi_type_indexed_f implicit none INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 index 244a6e2378b..912c377856a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 @@ -10,7 +10,7 @@ #include "mpi-f08-rename.h" subroutine MPI_Type_size_f08(datatype,size,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_Datatype use :: ompi_mpifh_bindings, only : ompi_type_size_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 index a85f5b62523..96ea7a2d0f6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 @@ -10,7 +10,7 @@ #include "mpi-f08-rename.h" subroutine MPI_Win_detach_f08(win,base,ierror) - use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_Win use :: ompi_mpifh_bindings, only : ompi_win_detach_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: base diff --git a/ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 index 99088f8b277..0733e400acb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 @@ -11,7 +11,7 @@ subroutine MPI_Win_get_name_f08(win,win_name,resultlen,ierror) use, intrinsic :: ISO_C_BINDING, only : C_CHAR - use :: mpi_f08_types, only : MPI_Win, MPI_MAX_OBJECT_NAME + use :: mpi_f08_types, only : MPI_Win use :: ompi_mpifh_bindings, only : ompi_win_get_name_f implicit none TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr.F90 b/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr.F90 index cb1ce70966e..d2662a60702 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr.F90 +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr.F90 @@ -27,12 +27,18 @@ module mpi #if OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS use mpi_types #endif + + ! Sentinel values such as MPI_BOTTOM (that are the same types as in + ! mpi_f08 -- not including MPI_STATUS[ES]_IGNORE, which are + ! different types in mpi_f08). + use mpi_sentinels + include "mpif-config.h" include "mpif-constants.h" include "mpif-handles.h" include "mpif-io-constants.h" include "mpif-io-handles.h" - include "mpif-sentinels.h" + include "mpif-status.h" ! The MPI attribute callback functions diff --git a/ompi/mpi/fortran/use-mpi/Makefile.am b/ompi/mpi/fortran/use-mpi/Makefile.am index 3f1bc6b1760..3d2f88441f0 100644 --- a/ompi/mpi/fortran/use-mpi/Makefile.am +++ b/ompi/mpi/fortran/use-mpi/Makefile.am @@ -48,6 +48,11 @@ noinst_LTLIBRARIES = libusempi_internal_modules.la nodist_libusempi_internal_modules_la_SOURCES = \ mpi-types.F90 +# mpif-sentinels.F90 is *not* generated, and should be distributed. +libusempi_internal_modules_la_SOURCES = \ + mpi-sentinels.F90 + +mpi-sentinels.lo: mpi-sentinels.F90 mpi-types.lo: mpi-types.F90 # Install the generated .mod files. Unfortunately, each F90 compiler diff --git a/ompi/mpi/fortran/use-mpi/mpi-sentinels.F90 b/ompi/mpi/fortran/use-mpi/mpi-sentinels.F90 new file mode 100644 index 00000000000..a9d05efe319 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi/mpi-sentinels.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! Copyright (c) 2022 Cisco Systems, Inc. All rights reserved +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ +! + +! These sentinel values are needed in both the mpi and mpi_f08 +! modules. +module mpi_sentinels + + include "mpif-sentinels.h" + +end module diff --git a/ompi/mpiext/example/use-mpi-f08/Makefile.am b/ompi/mpiext/example/use-mpi-f08/Makefile.am index f495b4414d6..cf1f6165d3a 100644 --- a/ompi/mpiext/example/use-mpi-f08/Makefile.am +++ b/ompi/mpiext/example/use-mpi-f08/Makefile.am @@ -12,9 +12,18 @@ # This file builds the use_mpi_f08-based bindings for MPI extensions. It # is optional in MPI extensions. +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # We must set these #defines and include paths so that the inner OMPI # MPI prototype header files do the Right Thing. -AM_FCFLAGS = $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ +AM_FCFLAGS = \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ -I$(top_srcdir) $(FCFLAGS_f90) # Note that the mpi_f08-based bindings are optional -- they can only diff --git a/ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am b/ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am index d06c0aa6837..aed4f34e537 100644 --- a/ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am +++ b/ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am @@ -16,9 +16,17 @@ # This file builds the use_mpi_f08-based bindings for MPI extensions. It # is optional in MPI extensions. +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # We must set these #defines and include paths so that the inner OMPI # MPI prototype header files do the Right Thing. AM_FCFLAGS = $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ -I$(top_builddir) -I$(top_srcdir) $(FCFLAGS_f90) diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index c52db8131e7..27de26a0cd2 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -209,29 +209,10 @@ struct ompi_status_public_t *ompi_mpi_statuses_ignore_addr = * complain. */ #if OMPI_BUILD_FORTRAN_BINDINGS -# if OMPI_FORTRAN_CAPS -MPI_Fint *MPI_F_STATUS_IGNORE = (MPI_Fint*) &MPI_FORTRAN_STATUS_IGNORE; -MPI_Fint *MPI_F_STATUSES_IGNORE = (MPI_Fint*) &MPI_FORTRAN_STATUSES_IGNORE; -MPI_Fint *MPI_F08_STATUS_IGNORE = (MPI_Fint*) &MPI_FORTRAN_STATUS_IGNORE; -MPI_Fint *MPI_F08_STATUSES_IGNORE = (MPI_Fint*) &MPI_FORTRAN_STATUSES_IGNORE; -# elif OMPI_FORTRAN_PLAIN MPI_Fint *MPI_F_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore; MPI_Fint *MPI_F_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore; MPI_Fint *MPI_F08_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore; MPI_Fint *MPI_F08_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore; -# elif OMPI_FORTRAN_SINGLE_UNDERSCORE -MPI_Fint *MPI_F_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore_; -MPI_Fint *MPI_F_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore_; -MPI_Fint *MPI_F08_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore_; -MPI_Fint *MPI_F08_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore_; -# elif OMPI_FORTRAN_DOUBLE_UNDERSCORE -MPI_Fint *MPI_F_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore__; -MPI_Fint *MPI_F_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore__; -MPI_Fint *MPI_F08_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore__; -MPI_Fint *MPI_F08_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore__; -# else -# error Unrecognized Fortran name mangling scheme -# endif #else MPI_Fint *MPI_F_STATUS_IGNORE = NULL; MPI_Fint *MPI_F_STATUSES_IGNORE = NULL;