diff --git a/config/ompi_setup_mpi_fortran.m4 b/config/ompi_setup_mpi_fortran.m4 index adb40ecc06b..12375c24264 100644 --- a/config/ompi_setup_mpi_fortran.m4 +++ b/config/ompi_setup_mpi_fortran.m4 @@ -387,6 +387,10 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[ [OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS AC_MSG_RESULT([no])]) + OMPI_FORTRAN_CHECK_BIND_C_TYPE( + [OMPI_FORTRAN_HAVE_BIND_C_TYPE=1], + [OMPI_FORTRAN_HAVE_BIND_C_TYPE=0]) + #--------------------------------- # Fortran use mpi_f08 MPI bindings #--------------------------------- @@ -422,14 +426,11 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[ [OMPI_FORTRAN_HAVE_BIND_C_SUB=0 OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])]) - OMPI_FORTRAN_HAVE_BIND_C_TYPE=0 AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \ test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS], [ # If we don't have TYPE, BIND(C), we won't build mpi_f08 at all - OMPI_FORTRAN_CHECK_BIND_C_TYPE( - [OMPI_FORTRAN_HAVE_BIND_C_TYPE=1], - [OMPI_FORTRAN_HAVE_BIND_C_TYPE=0 - OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])]) + AS_IF([test $OMPI_FORTRAN_HAVE_BIND_C_TYPE -ne 1], + [OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])]) # Per discussion on the devel list starting here: # https://www.open-mpi.org/community/lists/devel/2014/01/13799.php @@ -701,6 +702,17 @@ end type test_mpi_handle], AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS, [test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \ test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1]) + # True if we support TYPE, BIND(C) + AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE, + [$OMPI_FORTRAN_HAVE_BIND_C_TYPE], + [For ompi_info: Whether the compiler supports TYPE, BIND(C) or not]) + AC_SUBST(OMPI_FORTRAN_HAVE_BIND_C_TYPE) + + # For mpif-status.h, configure-fortran-output.h, mpi-f08-types.F90 (and ompi_info) + AC_SUBST([OMPI_FORTRAN_HAVE_PRIVATE]) + AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PRIVATE], + [$OMPI_FORTRAN_HAVE_PRIVATE], + [For mpif-status.h, mpi-f08-types.f90 and ompi_info: whether the compiler supports the "private" keyword or not (used in MPI_Status)]) # ------------------- # use mpi_f08 final setup @@ -749,9 +761,6 @@ end type test_mpi_handle], AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_SUB, [$OMPI_FORTRAN_HAVE_BIND_C_SUB], [For ompi_info: Whether the compiler supports SUBROUTINE ... BIND(C) or not]) - AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE, - [$OMPI_FORTRAN_HAVE_BIND_C_TYPE], - [For ompi_info: Whether the compiler supports TYPE, BIND(C) or not]) AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME, [$OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME], [For ompi_info: Whether the compiler supports TYPE, BIND(C, NAME="name") or not]) @@ -759,12 +768,6 @@ end type test_mpi_handle], [$OMPI_FORTRAN_HAVE_OPTIONAL_ARGS], [For ompi_info: whether the Fortran compiler supports optional arguments or not]) - # For configure-fortran-output.h, mpi-f08-types.F90 (and ompi_info) - AC_SUBST([OMPI_FORTRAN_HAVE_PRIVATE]) - AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PRIVATE], - [$OMPI_FORTRAN_HAVE_PRIVATE], - [For mpi-f08-types.f90 and ompi_info: whether the compiler supports the "private" keyword or not (used in MPI_Status)]) - # For configure-fortran-output.h, mpi-f08-interfaces-callbacks.F90 # (and ompi_info) AC_SUBST([OMPI_FORTRAN_HAVE_ABSTRACT]) diff --git a/ompi/include/Makefile.am b/ompi/include/Makefile.am index 8384b864bef..f6f051a8fd4 100644 --- a/ompi/include/Makefile.am +++ b/ompi/include/Makefile.am @@ -11,8 +11,8 @@ # All rights reserved. # Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved. -# Copyright (c) 2014-2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2014-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ # @@ -54,6 +54,7 @@ nodist_include_HEADERS = \ mpif.h \ mpif-ext.h \ mpif-sizeof.h \ + mpif-status.h \ mpif-c-constants-decl.h \ mpi_portable_platform.h @@ -92,6 +93,18 @@ mpif-sizeof.h: --complex4=$(OMPI_HAVE_FORTRAN_COMPLEX4) \ --complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32) +# +# mpif-status.h is generated based on some results from configure tests. +# + +status_pl=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-status.pl +mpif-status.h: $(top_builddir)/config.status +mpif-status.h: $(sizeof_pl) +mpif-status.h: + $(OMPI_V_GEN) $(status_pl) \ + --mpi_status=$(OMPI_FORTRAN_HAVE_BIND_C_TYPE) \ + --private=$(OMPI_FORTRAN_HAVE_PRIVATE) + # # mpif-c-constants-decl.h, among other files, is generated based on some # results from configure tests. @@ -124,6 +137,7 @@ CLEANFILES = mpif-sizeof.f90 distclean-local: rm -f mpi-ext.h mpif-ext.h mpi_portable_platform.h \ mpif-sizeof.h \ + mpif-status.h \ mpif-c-constants-decl.h mpif-c-constants.h mpif-f08-types.h mpi_portable_platform.h: $(top_srcdir)/opal/include/opal/opal_portable_platform.h diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 2368d9df1e8..7079f3335a2 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -411,6 +411,7 @@ typedef struct ompi_op_t *MPI_Op; typedef struct ompi_request_t *MPI_Request; typedef struct ompi_message_t *MPI_Message; typedef struct ompi_status_public_t MPI_Status; +typedef struct ompi_f08_status_public_t MPI_F08_status; typedef struct ompi_win_t *MPI_Win; typedef struct mca_base_var_enum_t *MPI_T_enum; typedef struct ompi_mpit_cvar_handle_t *MPI_T_cvar_handle; @@ -1779,7 +1780,11 @@ OMPI_DECLSPEC int MPI_Ssend(const void *buf, int count, MPI_Datatype datatype, OMPI_DECLSPEC int MPI_Start(MPI_Request *request); OMPI_DECLSPEC int MPI_Startall(int count, MPI_Request array_of_requests[]); OMPI_DECLSPEC int MPI_Status_c2f(const MPI_Status *c_status, MPI_Fint *f_status); +OMPI_DECLSPEC int MPI_Status_c2f08(const MPI_Status *c_status, MPI_F08_status *f08_status); +OMPI_DECLSPEC int MPI_Status_f082c(const MPI_F08_status *f08_status, MPI_Status *c_status); +OMPI_DECLSPEC int MPI_Status_f082f(const MPI_F08_status *f08_status, MPI_Fint *f_status); OMPI_DECLSPEC int MPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status); +OMPI_DECLSPEC int MPI_Status_f2f08(const MPI_Fint *f_status, MPI_F08_status *f08_status); OMPI_DECLSPEC int MPI_Status_set_cancelled(MPI_Status *status, int flag); OMPI_DECLSPEC int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count); @@ -2440,7 +2445,11 @@ OMPI_DECLSPEC int PMPI_Ssend(const void *buf, int count, MPI_Datatype datatype, OMPI_DECLSPEC int PMPI_Start(MPI_Request *request); OMPI_DECLSPEC int PMPI_Startall(int count, MPI_Request array_of_requests[]); OMPI_DECLSPEC int PMPI_Status_c2f(const MPI_Status *c_status, MPI_Fint *f_status); +OMPI_DECLSPEC int PMPI_Status_c2f08(const MPI_Status *c_status, MPI_F08_status *f08_status); +OMPI_DECLSPEC int PMPI_Status_f082f(const MPI_F08_status *f08_status, MPI_Fint *f_status); +OMPI_DECLSPEC int PMPI_Status_f082c(const MPI_F08_status *f08_status, MPI_Status *c_status); OMPI_DECLSPEC int PMPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status); +OMPI_DECLSPEC int PMPI_Status_f2f08(const MPI_Fint *f_status, MPI_F08_status *f08_status); OMPI_DECLSPEC int PMPI_Status_set_cancelled(MPI_Status *status, int flag); OMPI_DECLSPEC int PMPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count); diff --git a/ompi/mpi/c/Makefile.am b/ompi/mpi/c/Makefile.am index d4c822beba2..d58b564f225 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -15,8 +15,8 @@ # Copyright (c) 2012-2013 Inria. All rights reserved. # Copyright (c) 2013-2018 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -339,7 +339,11 @@ libmpi_c_mpi_la_SOURCES = \ start.c \ startall.c \ status_c2f.c \ + status_c2f08.c \ + status_f082c.c \ + status_f082f.c \ status_f2c.c \ + status_f2f08.c \ status_set_cancelled.c \ status_set_elements.c \ status_set_elements_x.c \ diff --git a/ompi/mpi/c/profile/Makefile.am b/ompi/mpi/c/profile/Makefile.am index 5330752db5c..d4c0545829e 100644 --- a/ompi/mpi/c/profile/Makefile.am +++ b/ompi/mpi/c/profile/Makefile.am @@ -319,6 +319,10 @@ nodist_libmpi_c_pmpi_la_SOURCES = \ pstart.c \ pstartall.c \ pstatus_c2f.c \ + pstatus_c2f08.c \ + pstatus_f082c.c \ + pstatus_f082f.c \ + pstatus_f2f08.c \ pstatus_f2c.c \ pstatus_set_cancelled.c \ pstatus_set_elements.c \ diff --git a/ompi/mpi/c/status_c2f08.c b/ompi/mpi/c/status_c2f08.c new file mode 100644 index 00000000000..825c2b146e6 --- /dev/null +++ b/ompi/mpi/c/status_c2f08.c @@ -0,0 +1,86 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 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-2008 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) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" +#include + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" +#include "ompi/memchecker.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Status_c2f08 = PMPI_Status_c2f08 +#endif +#define MPI_Status_c2f08 PMPI_Status_c2f08 +#endif + +static const char FUNC_NAME[] = "MPI_Status_c2f08"; + + +int MPI_Status_c2f08(const MPI_Status *c_status, MPI_F08_status *f08_status) +{ + const int *c_ints; + MEMCHECKER( + if(c_status != MPI_STATUSES_IGNORE) { + /* + * Before checking the complete status, we need to reset the definedness + * of the MPI_ERROR-field (single-completion calls wait/test). + */ + opal_memchecker_base_mem_defined((void*)&c_status->MPI_ERROR, sizeof(int)); + memchecker_status(c_status); + } + ); + + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + + /* MPI-2:4.12.5 says that if you pass in + MPI_STATUS[ES]_IGNORE, it's erroneous */ + + if (NULL == c_status || MPI_STATUS_IGNORE == c_status || + MPI_STATUSES_IGNORE == c_status || NULL == f08_status) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_IN_STATUS, FUNC_NAME); + } + } + + /* ***NOTE*** See huge comment in status_c2f.c (yes, I know + there's a size_t member in the C MPI_Status -- go + read that comment for an explanation why copying + everything as a bunch of int's is ok). */ + f08_status->MPI_SOURCE = OMPI_INT_2_FINT(c_status->MPI_SOURCE); + f08_status->MPI_TAG = OMPI_INT_2_FINT(c_status->MPI_TAG); + f08_status->MPI_ERROR = OMPI_INT_2_FINT(c_status->MPI_ERROR); + c_ints = (const int *)c_status + 3; + for(int i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int) - 3); i++ ) + f08_status->internal[i] = OMPI_INT_2_FINT(c_ints[i]); + + return MPI_SUCCESS; +} diff --git a/ompi/mpi/c/status_f082c.c b/ompi/mpi/c/status_f082c.c new file mode 100644 index 00000000000..aaf6839d1bd --- /dev/null +++ b/ompi/mpi/c/status_f082c.c @@ -0,0 +1,84 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 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) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Status_f082c = PMPI_Status_f082c +#endif +#define MPI_Status_f082c PMPI_Status_f082c +#endif + +static const char FUNC_NAME[] = "MPI_Status_f082c"; + + +int MPI_Status_f082c(const MPI_F08_status *f08_status, MPI_Status *c_status) +{ + int *c_ints; + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + + /* MPI-2:4.12.5 says that if you pass in + MPI_STATUS[ES]_IGNORE, it's erroneous */ + + if (NULL == f08_status || +#if OMPI_BUILD_FORTRAN_BINDINGS + /* This section is #if'ed out if we are not building the + fortran bindings because these macros check values + against constants that only exist if the fortran + bindings exist. */ + OMPI_IS_FORTRAN_STATUS_IGNORE(f08_status) || + OMPI_IS_FORTRAN_STATUSES_IGNORE(f08_status) || +#endif + NULL == c_status) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_IN_STATUS, FUNC_NAME); + } + } + + /* ***NOTE*** See huge comment in status_c2f.c (yes, I know + there's a size_t member in the C MPI_Status -- go + read that comment for an explanation why copying + everything as a bunch of int's is ok). + + We can't use OMPI_FINT_2_INT here because of some complications + with include files. :-( So just do the casting manually. */ + c_status->MPI_SOURCE = (int)f08_status->MPI_SOURCE; + c_status->MPI_TAG = (int)f08_status->MPI_TAG; + c_status->MPI_ERROR = (int)f08_status->MPI_ERROR; + c_ints = (int *)c_status + 3; + for(int i=0; i < (int)(sizeof(MPI_Status) / sizeof(int) - 3); i++) + c_ints[i] = (int)f08_status->internal[i]; + + return MPI_SUCCESS; +} diff --git a/ompi/mpi/c/status_f082f.c b/ompi/mpi/c/status_f082f.c new file mode 100644 index 00000000000..300aaadd81c --- /dev/null +++ b/ompi/mpi/c/status_f082f.c @@ -0,0 +1,79 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 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) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Status_f082f = PMPI_Status_f082f +#endif +#define MPI_Status_f082f PMPI_Status_f082f +#endif + +static const char FUNC_NAME[] = "MPI_Status_f082f"; + + +int MPI_Status_f082f(const MPI_F08_status *f08_status, MPI_Fint *f_status) +{ + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + + /* MPI-2:4.12.5 says that if you pass in + MPI_STATUS[ES]_IGNORE, it's erroneous */ + + if (NULL == f08_status || +#if OMPI_BUILD_FORTRAN_BINDINGS + /* This section is #if'ed out if we are not building the + fortran bindings because these macros check values + against constants that only exist if the fortran + bindings exist. */ + OMPI_IS_FORTRAN_STATUS_IGNORE(f08_status) || + OMPI_IS_FORTRAN_STATUSES_IGNORE(f08_status) || +#endif + NULL == f_status) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_IN_STATUS, FUNC_NAME); + } + } + + MPI_Status c_status; + int ret; + + ret = PMPI_Status_f082c(f08_status, &c_status); + if (MPI_SUCCESS != ret) { + return ret; + } + + ret = PMPI_Status_c2f(&c_status, f_status); + + return ret; +} diff --git a/ompi/mpi/c/status_f2f08.c b/ompi/mpi/c/status_f2f08.c new file mode 100644 index 00000000000..8b55ec5d285 --- /dev/null +++ b/ompi/mpi/c/status_f2f08.c @@ -0,0 +1,81 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 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-2008 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) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" +#include + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" +#include "ompi/memchecker.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Status_f2f08 = PMPI_Status_f2f08 +#endif +#define MPI_Status_f2f08 PMPI_Status_f2f08 +#endif + +static const char FUNC_NAME[] = "MPI_Status_f2f08"; + + +int MPI_Status_f2f08(const MPI_Fint *f_status, MPI_F08_status *f08_status) +{ + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + + /* MPI-2:4.12.5 says that if you pass in + MPI_STATUS[ES]_IGNORE, it's erroneous */ + + if (NULL == f_status || +#if OMPI_BUILD_FORTRAN_BINDINGS + /* This section is #if'ed out if we are not building the + fortran bindings because these macros check values + against constants that only exist if the fortran + bindings exist. */ + OMPI_IS_FORTRAN_STATUS_IGNORE(f_status) || + OMPI_IS_FORTRAN_STATUSES_IGNORE(f_status) || +#endif + NULL == f08_status) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_IN_STATUS, FUNC_NAME); + } + } + + MPI_Status c_status; + int ret; + + ret = PMPI_Status_f2c(f_status, &c_status); + if (MPI_SUCCESS != ret) { + return ret; + } + + ret = PMPI_Status_c2f08(&c_status, f08_status); + + return ret; +} diff --git a/ompi/mpi/fortran/base/Makefile.am b/ompi/mpi/fortran/base/Makefile.am index 7109e453c47..ec99b606f06 100644 --- a/ompi/mpi/fortran/base/Makefile.am +++ b/ompi/mpi/fortran/base/Makefile.am @@ -10,8 +10,8 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015-2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -25,6 +25,7 @@ EXTRA_DIST = \ attr-fn-int-callback-interfaces.h \ conversion-fn-null-int-interface.h \ gen-mpi-sizeof.pl \ + gen-mpi-status.pl \ gen-mpi-mangling.pl #----------------------------------------------------------------------------- diff --git a/ompi/mpi/fortran/base/gen-mpi-status.pl b/ompi/mpi/fortran/base/gen-mpi-status.pl new file mode 100755 index 00000000000..ab5cdf54676 --- /dev/null +++ b/ompi/mpi/fortran/base/gen-mpi-status.pl @@ -0,0 +1,71 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# $COPYRIGHT$ +# +# Script to generate the type(MPI_Status) definition files. +# +# This script won't really be necessary (i.e., be a whole lot simpler) +# when Fortran compilers uniformly support what they have to. +# +# But for the meantime, we generate this file. + +use strict; + +use Getopt::Long; + +my $mpi_status; +my $private; +my $help_arg = 0; + +&Getopt::Long::Configure("bundling"); +my $ok = Getopt::Long::GetOptions("mpi_status=i" => \$mpi_status, + "private=i" => \$private, + "help|h" => \$help_arg); + +die "Must specify the --mpi_status and --private arguments" + if (!defined($mpi_status) || !defined($private)); + +my $filename = "mpif-status.h"; + +unlink($filename); +open(OUT, ">$filename") || die "Can't open $filename for writing"; +print OUT "! -*- f90 -*- +! WARNING: This is a generated file! Edits will be lost! +! +! Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. +! \$COPYRIGHT\$ +! +! This file was generated by gen-mpi-status.pl. + +"; + +if ($mpi_status) { + my $OMPI_PRIVATE=""; + if ($private) { + $OMPI_PRIVATE=", PRIVATE "; + } + print OUT "type, BIND(C) :: MPI_Status + integer :: MPI_SOURCE + integer :: MPI_TAG + integer :: MPI_ERROR + ! The mpif.h interface uses MPI_STATUS_SIZE to know how long of + ! an array of INTEGERs is necessary to hold a C MPI_Status. + ! Effectively do the same thing here: pad out this datatype with + ! as many INTEGERs as there are C int\'s can fit in + ! sizeof(MPI_Status) bytes -- see MPI_Status_ctof() for an + ! explanation why. + ! + ! This padding makes this F08 Type(MPI_Status) be the same size + ! as the mpif.h status (i.e., an array of MPI_STATUS_SIZE + ! INTEGERs), which is critical for MPI_Status_ctof() to not + ! overwrite memory. + integer$OMPI_PRIVATE :: internal(MPI_STATUS_SIZE - 3) + end type MPI_Status +"; +} else { + print OUT "! type(MPI_Status) is not supported by the compiler +"; +} +close(OUT); diff --git a/ompi/mpi/fortran/mpif-h/Makefile.am b/ompi/mpi/fortran/mpif-h/Makefile.am index 1b1f80d8527..827bb6b25af 100644 --- a/ompi/mpi/fortran/mpif-h/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/Makefile.am @@ -385,6 +385,8 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ ssend_init_f.c \ startall_f.c \ start_f.c \ + status_f082f_f.c \ + status_f2f08_f.c \ status_set_cancelled_f.c \ status_set_elements_f.c \ status_set_elements_x_f.c \ diff --git a/ompi/mpi/fortran/mpif-h/profile/Makefile.am b/ompi/mpi/fortran/mpif-h/profile/Makefile.am index 35a9390f6fb..d432519ec62 100644 --- a/ompi/mpi/fortran/mpif-h/profile/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/profile/Makefile.am @@ -298,6 +298,8 @@ linked_files = \ pssend_init_f.c \ pstartall_f.c \ pstart_f.c \ + pstatus_f082f_f.c \ + pstatus_f2f08_f.c \ pstatus_set_cancelled_f.c \ pstatus_set_elements_f.c \ pstatus_set_elements_x_f.c \ diff --git a/ompi/mpi/fortran/mpif-h/prototypes_mpi.h b/ompi/mpi/fortran/mpif-h/prototypes_mpi.h index 6a664e9bd2f..11deeff48fa 100644 --- a/ompi/mpi/fortran/mpif-h/prototypes_mpi.h +++ b/ompi/mpi/fortran/mpif-h/prototypes_mpi.h @@ -354,6 +354,8 @@ PN2(void, MPI_Ssend_init, mpi_ssend_init, MPI_SSEND_INIT, (char *buf, MPI_Fint * PN2(void, MPI_Ssend, mpi_ssend, MPI_SSEND, (char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr)); PN2(void, MPI_Start, mpi_start, MPI_START, (MPI_Fint *request, MPI_Fint *ierr)); PN2(void, MPI_Startall, mpi_startall, MPI_STARTALL, (MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *ierr)); +PN2(void, MPI_Status_f082f, mpi_status_f082f, MPI_STATUS_F082F, (const MPI_F08_status *f08_status, MPI_Fint *f_status, MPI_Fint *ierr)); +PN2(void, MPI_Status_f2f08, mpi_status_f2f08, MPI_STATUS_F2F08, (const MPI_Fint *f_status, MPI_F08_status *f08_status, MPI_Fint *ierr)); PN2(void, MPI_Status_set_cancelled, mpi_status_set_cancelled, MPI_STATUS_SET_CANCELLED, (MPI_Fint *status, ompi_fortran_logical_t *flag, MPI_Fint *ierr)); PN2(void, MPI_Status_set_elements, mpi_status_set_elements, MPI_STATUS_SET_ELEMENTS, (MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr)); PN2(void, MPI_Status_set_elements_x, mpi_status_set_elements_x, MPI_STATUS_SET_ELEMENTS_X, (MPI_Fint *status, MPI_Fint *datatype, MPI_Count *count, MPI_Fint *ierr)); diff --git a/ompi/mpi/fortran/mpif-h/status_f082f_f.c b/ompi/mpi/fortran/mpif-h/status_f082f_f.c new file mode 100644 index 00000000000..80432fdc53e --- /dev/null +++ b/ompi/mpi/fortran/mpif-h/status_f082f_f.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/fortran/mpif-h/bindings.h" +#include "ompi/mpi/fortran/base/constants.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak PMPI_STATUS_F082F = ompi_status_f082f_f +#pragma weak pmpi_status_f082f = ompi_status_f082f_f +#pragma weak pmpi_status_f082f_ = ompi_status_f082f_f +#pragma weak pmpi_status_f082f__ = ompi_status_f082f_f + +#pragma weak PMPI_Status_f082f_f = ompi_status_f082f_f +#pragma weak PMPI_Status_f082f_f08 = ompi_status_f082f_f +#else +OMPI_GENERATE_F77_BINDINGS(PMPI_STATUS_F082F, + pmpi_status_f082f, + pmpi_status_f082f_, + pmpi_status_f082f__, + pompi_status_f082f_f, + (const MPI_F08_status *f08_status, MPI_Fint *f_status, MPI_Fint *ierr), + (f08_status, f_status, ierr) ) +#endif +#endif + +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_STATUS_F082F = ompi_status_f082f_f +#pragma weak mpi_status_f082f = ompi_status_f082f_f +#pragma weak mpi_status_f082f_ = ompi_status_f082f_f +#pragma weak mpi_status_f082f__ = ompi_status_f082f_f + +#pragma weak MPI_Status_f082f_f = ompi_status_f082f_f +#pragma weak MPI_Status_f082f_f08 = ompi_status_f082f_f +#else +#if ! OMPI_BUILD_MPI_PROFILING +OMPI_GENERATE_F77_BINDINGS(MPI_STATUS_F082F, + mpi_status_f082f, + mpi_status_f082f_, + mpi_status_f082f__, + ompi_status_f082f_f, + (const MPI_F08_status *f08_status, MPI_Fint *f_status, MPI_Fint *ierr), + (f08_status, f_status, ierr) ) +#else +#define ompi_status_f082f_f pompi_status_f082f_f +#endif +#endif + + +void ompi_status_f082f_f(const MPI_F08_status *f08_status, MPI_Fint *f_status, MPI_Fint *ierr) +{ + f_status[0] = f08_status->MPI_SOURCE; + f_status[1] = f08_status->MPI_TAG; + f_status[2] = f08_status->MPI_ERROR; + for (int i=0; iinternal[i]; + } + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(MPI_SUCCESS); +} diff --git a/ompi/mpi/fortran/mpif-h/status_f2f08_f.c b/ompi/mpi/fortran/mpif-h/status_f2f08_f.c new file mode 100644 index 00000000000..3ed97a04fad --- /dev/null +++ b/ompi/mpi/fortran/mpif-h/status_f2f08_f.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/fortran/mpif-h/bindings.h" +#include "ompi/mpi/fortran/base/constants.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak PMPI_STATUS_F2F08 = ompi_status_f2f08_f +#pragma weak pmpi_status_f2f08 = ompi_status_f2f08_f +#pragma weak pmpi_status_f2f08_ = ompi_status_f2f08_f +#pragma weak pmpi_status_f2f08__ = ompi_status_f2f08_f + +#pragma weak PMPI_Status_f2f08_f = ompi_status_f2f08_f +#pragma weak PMPI_Status_f2f08_f08 = ompi_status_f2f08_f +#else +OMPI_GENERATE_F77_BINDINGS(PMPI_STATUS_F2F08, + pmpi_status_f2f08, + pmpi_status_f2f08_, + pmpi_status_f2f08__, + pompi_status_f2f08_f, + (const MPI_Fint *f_status, MPI_F08_status *f08_status, MPI_Fint *ierr), + (f_status, f08_status, ierr) ) +#endif +#endif + +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_STATUS_F2F08 = ompi_status_f2f08_f +#pragma weak mpi_status_f2f08 = ompi_status_f2f08_f +#pragma weak mpi_status_f2f08_ = ompi_status_f2f08_f +#pragma weak mpi_status_f2f08__ = ompi_status_f2f08_f + +#pragma weak MPI_Status_f2f08_f = ompi_status_f2f08_f +#pragma weak MPI_Status_f2f08_f08 = ompi_status_f2f08_f +#else +#if ! OMPI_BUILD_MPI_PROFILING +OMPI_GENERATE_F77_BINDINGS(MPI_STATUS_F2F08, + mpi_status_f2f08, + mpi_status_f2f08_, + mpi_status_f2f08__, + ompi_status_f2f08_f, + (const MPI_Fint *f_stttttatus, MPI_F08_status *f08_status *f08_status, MPI_Fint *ierr), + (f_status, f08_status, ierr) ) +#else +#define ompi_status_f2f08_f pompi_status_f2f08_f +#endif +#endif + + +void ompi_status_f2f08_f(const MPI_Fint *f_status, MPI_F08_status *f08_status, MPI_Fint *ierr) +{ + f08_status->MPI_SOURCE = f_status[0]; + f08_status->MPI_TAG = f_status[1]; + f08_status->MPI_ERROR = f_status[2]; + for (int i=0; iinternal[i] = f_status[3+i]; + } + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(MPI_SUCCESS); +} diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/Makefile.am index 2ed9a01997f..584a3db03ce 100644 --- a/ompi/mpi/fortran/use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/Makefile.am @@ -7,7 +7,7 @@ # Copyright (c) 2012-2013 Inria. All rights reserved. # Copyright (c) 2013-2018 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2019 Research Organization for Information Science +# Copyright (c) 2015-2020 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved. @@ -363,6 +363,8 @@ mpi_api_files = \ ssend_init_f08.F90 \ startall_f08.F90 \ start_f08.F90 \ + status_f082f_f08.F90 \ + status_f2f08_f08.F90 \ status_set_cancelled_f08.F90 \ status_set_elements_f08.F90 \ status_set_elements_x_f08.F90 \ @@ -718,6 +720,8 @@ pmpi_api_files = \ profile/pssend_init_f08.F90 \ profile/pstartall_f08.F90 \ profile/pstart_f08.F90 \ + profile/pstatus_f082f_f08.F90 \ + profile/pstatus_f2f08_f08.F90 \ profile/pstatus_set_cancelled_f08.F90 \ profile/pstatus_set_elements_f08.F90 \ profile/pstatus_set_elements_x_f08.F90 \ diff --git a/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am index 7e1bc3bc299..7b62c571a4a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am @@ -1,6 +1,8 @@ # -*- makefile -*- # -# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # # $COPYRIGHT$ # 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 32437112347..140ad0d01f2 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 @@ -7,7 +7,7 @@ ! of Tennessee Research Foundation. All rights ! reserved. ! Copyright (c) 2012 Inria. All rights reserved. -! Copyright (c) 2015-2019 Research Organization for Information Science +! Copyright (c) 2015-2020 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ ! @@ -2635,6 +2635,24 @@ subroutine ompi_query_thread_f(provided,ierror) & INTEGER, INTENT(OUT) :: ierror end subroutine ompi_query_thread_f +subroutine ompi_status_f082f_f(f08_status,f_status,ierror) & + BIND(C, name="ompi_status_f2f08_f") + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, INTENT(OUT) :: ierror +end subroutine ompi_status_f082f_f + +subroutine ompi_status_f2f08_f(f_status,f08_status,ierror) & + BIND(C, name="ompi_status_f082f_f") + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, INTENT(OUT) :: ierror +end subroutine ompi_status_f2f08_f + subroutine ompi_status_set_elements_f(status,datatype,count,ierror) & BIND(C, name="ompi_status_set_elements_f") use :: mpi_f08_types, only : MPI_Status 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 55ae341d800..46100f46d5a 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 @@ -7,8 +7,8 @@ ! of Tennessee Research Foundation. All rights ! reserved. ! Copyright (c) 2012 Inria. All rights reserved. -! Copyright (c) 2015-2017 Research Organization for Information Science -! and Technology (RIST). All rights reserved. +! Copyright (c) 2015-2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ ! @@ -3498,6 +3498,26 @@ subroutine MPI_Query_thread_f08(provided,ierror) end subroutine MPI_Query_thread_f08 end interface MPI_Query_thread +interface MPI_Status_f082f +subroutine MPI_Status_f082f_f08(f08_status,f_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +end subroutine MPI_Status_f082f_f08 +end interface MPI_Status_f082f + +interface MPI_Status_f2f08 +subroutine MPI_Status_f2f08_f08(f_status,f08_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +end subroutine MPI_Status_f2f08_f08 +end interface MPI_Status_f2f08 + interface MPI_Status_set_cancelled subroutine MPI_Status_set_cancelled_f08(status,flag,ierror) use :: mpi_f08_types, only : MPI_Status 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 a383f3bcf75..d193c1a1fc2 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 @@ -3,7 +3,7 @@ ! Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. -! Copyright (c) 2015-2019 Research Organization for Information Science +! 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 @@ -70,23 +70,7 @@ module mpi_f08_types integer :: MPI_VAL end type MPI_Win - type, BIND(C) :: MPI_Status - integer :: MPI_SOURCE - integer :: MPI_TAG - integer :: MPI_ERROR - ! The mpif.h interface uses MPI_STATUS_SIZE to know how long of - ! an array of INTEGERs is necessary to hold a C MPI_Status. - ! Effectively do the same thing here: pad out this datatype with - ! as many INTEGERs as there are C int's can fit in - ! sizeof(MPI_Status) bytes -- see MPI_Status_ctof() for an - ! explanation why. - ! - ! This padding makes this F08 Type(MPI_Status) be the same size - ! as the mpif.h status (i.e., an array of MPI_STATUS_SIZE - ! INTEGERs), which is critical for MPI_Status_ctof() to not - ! overwrite memory. - integer OMPI_PRIVATE :: internal(MPI_STATUS_SIZE - 3) - end type MPI_Status +#include "ompi/include/mpif-status.h" ! ! Pre-defined handles 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 6e02e8aac2c..95ebf8fe5b1 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 @@ -7,8 +7,8 @@ ! of Tennessee Research Foundation. All rights ! reserved. ! Copyright (c) 2012 Inria. All rights reserved. -! Copyright (c) 2015-2017 Research Organization for Information Science -! and Technology (RIST). All rights reserved. +! Copyright (c) 2015-2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ ! @@ -3498,6 +3498,26 @@ subroutine PMPI_Query_thread_f08(provided,ierror) end subroutine PMPI_Query_thread_f08 end interface PMPI_Query_thread +interface PMPI_Status_f082f +subroutine PMPI_Status_f082f_f08(f08_status,f_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +end subroutine PMPI_Status_f082f_f08 +end interface PMPI_Status_f082f + +interface PMPI_Status_f2f08 +subroutine PMPI_Status_f2f08_f08(f_status,f08_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +end subroutine PMPI_Status_f2f08_f08 +end interface PMPI_Status_f2f08 + interface PMPI_Status_set_cancelled subroutine PMPI_Status_set_cancelled_f08(status,flag,ierror) use :: mpi_f08_types, only : MPI_Status diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f082f_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f082f_f08.F90 new file mode 100644 index 00000000000..8c31cc73b1b --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f082f_f08.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ + +subroutine PMPI_Status_f082f_f08(f08_status,f_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + use :: ompi_mpifh_bindings, only : ompi_status_f082f_f + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + integer :: c_ierror + + call ompi_status_f082f_f(f08_status, f_status, c_ierror) + if (present(ierror)) ierror = c_ierror + +end subroutine PMPI_Status_f082f_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f2f08_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f2f08_f08.F90 new file mode 100644 index 00000000000..5052c999b38 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f2f08_f08.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ + +subroutine PMPI_Status_f2f08_f08(f_status,f08_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + use :: ompi_mpifh_bindings, only : ompi_status_f2f08_f + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + integer :: c_ierror + + call ompi_status_f2f08_f(f_status, f08_status, c_ierror) + if (present(ierror)) ierror = c_ierror + +end subroutine PMPI_Status_f2f08_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/status_f082f_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/status_f082f_f08.F90 new file mode 100644 index 00000000000..e24519c3216 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/status_f082f_f08.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ + +subroutine MPI_Status_f082f_f08(f08_status,f_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + use :: ompi_mpifh_bindings, only : ompi_status_f082f_f + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + integer :: c_ierror + + call ompi_status_f082f_f(f08_status, f_status, c_ierror) + if (present(ierror)) ierror = c_ierror + +end subroutine MPI_Status_f082f_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/status_f2f08_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/status_f2f08_f08.F90 new file mode 100644 index 00000000000..1375d77204b --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/status_f2f08_f08.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ + +subroutine MPI_Status_f2f08_f08(f_status,f08_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + use :: ompi_mpifh_bindings, only : ompi_status_f2f08_f + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + integer :: c_ierror + + call ompi_status_f2f08_f(f_status, f08_status, c_ierror) + if (present(ierror)) ierror = c_ierror + +end subroutine MPI_Status_f2f08_f08 diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am index 481cf800472..9e61a09a4d4 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am @@ -1,8 +1,8 @@ # -*- makefile -*- # # Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. @@ -38,6 +38,7 @@ mpi-ignore-tkr-removed-interfaces.h: mpi-ignore-tkr-removed-interfaces.h.in mpi-ignore-tkr.lo: $(top_srcdir)/ompi/mpi/fortran/base/attr-fn-int-callback-interfaces.h mpi-ignore-tkr.lo: $(top_srcdir)/ompi/mpi/fortran/base/conversion-fn-null-int-interface.h mpi-ignore-tkr.lo: mpi-ignore-tkr-interfaces.h +mpi-ignore-tkr.lo: mpi-ignore-tkr-status.h mpi-ignore-tkr.lo: mpi-ignore-tkr-file-interfaces.h mpi-ignore-tkr.lo: mpi-ignore-tkr-removed-interfaces.h mpi-ignore-tkr.lo: mpi-ignore-tkr-sizeof.h @@ -45,7 +46,9 @@ mpi-ignore-tkr.lo: mpi-ignore-tkr-sizeof.f90 mpi-ignore-tkr.lo: mpi-ignore-tkr.F90 lib@OMPI_LIBMPI_NAME@_usempi_ignore_tkr_la_SOURCES = \ - mpi-ignore-tkr.F90 + mpi-ignore-tkr.F90 \ + mpi-ignore-tkr-status.h + nodist_lib@OMPI_LIBMPI_NAME@_usempi_ignore_tkr_la_SOURCES = \ mpi-ignore-tkr-interfaces.h \ mpi-ignore-tkr-file-interfaces.h \ diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h b/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h new file mode 100644 index 00000000000..de8990f3e59 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h @@ -0,0 +1,53 @@ +! -*- fortran -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ + + +interface MPI_Status_f082f + +subroutine MPI_Status_f082f(f08_status, f_status, ierror) + type(MPI_Status), intene(in) :: f08_status + integer, intent(out) :: f_status(MPI_STATUS_SIZE) + integer, intent(out) :: ierror +end subroutine MPI_Status_f082f + +end interface + + +interface MPI_Status_f2f08 + +subroutine MPI_Status_f2f08(f_status, f08_status, ierror) + integer, intent(in) :: f_status(MPI_STATUS_SIZE) + type(MPI_Status), intene(out) :: f08_status + integer, intent(out) :: ierror +end subroutine MPI_Status_f082f + +end interface + + +interface PMPI_Status_f082f + +subroutine PMPI_Status_f082f(f08_status, f_status, ierror) + type(MPI_Status), intene(in) :: f08_status + integer, intent(out) :: f_status(MPI_STATUS_SIZE) + integer, intent(out) :: ierror +end subroutine PMPI_Status_f082f + +end interface + + +interface PMPI_Status_f2f08 + +subroutine PMPI_Status_f2f08(f_status, f08_status, ierror) + integer, intent(in) :: f_status(MPI_STATUS_SIZE) + type(MPI_Status), intene(out) :: f08_status + integer, intent(out) :: ierror +end subroutine PMPI_Status_f082f + +end interface 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 e19c4280a93..db808ffc093 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 @@ -11,8 +11,8 @@ ! Copyright (c) 2004-2005 The Regents of the University of California. ! All rights reserved. ! Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. -! Copyright (c) 2017 Research Organization for Information Science -! and Technology (RIST). All rights reserved. +! Copyright (c) 2017-2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ ! ! Additional copyrights may follow @@ -30,6 +30,7 @@ module mpi include "mpif-io-constants.h" include "mpif-io-handles.h" include "mpif-sentinels.h" + include "mpif-status.h" ! The MPI attribute callback functions @@ -42,6 +43,9 @@ module mpi ! The ignore-TKR version of the MPI interfaces include "ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-interfaces.h" +#if OMPI_FORTRAN_HAVE_BIND_C_TYPE + include "ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h" +#endif include "ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h" #if !defined(OMPI_ENABLE_MPI1_COMPAT) diff --git a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am index 8ffd719dbb9..6722a1d133b 100644 --- a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am @@ -13,8 +13,8 @@ # Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2007 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2014-2016 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2014-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ @@ -66,11 +66,13 @@ lib_LTLIBRARIES += lib@OMPI_LIBMPI_NAME@_usempi.la mpi.lo: mpi.F90 mpi.lo: mpi-f90-interfaces.h +mpi.lo: mpi-f90-status.h mpi.lo: mpi-f90-file-interfaces.h mpi.lo: mpi-f90-removed-interfaces.h mpi.lo: $(top_builddir)/ompi/mpi/fortran/configure-fortran-output.h mpi.lo: mpi-f90-cptr-interfaces.h mpi.lo: pmpi-f90-interfaces.h +mpi.lo: pmpi-f90-status.h mpi.lo: pmpi-f90-file-interfaces.h mpi.lo: pmpi-f90-removed-interfaces.h mpi.lo: pmpi-f90-cptr-interfaces.h @@ -181,10 +183,12 @@ endif EXTRA_DIST = \ mpi-f90-interfaces.h \ + mpi-f90-status.h \ mpi-f90-file-interfaces.h \ mpi-f90-removed-interfaces.h \ mpi-f90-cptr-interfaces.h \ pmpi-f90-interfaces.h \ + pmpi-f90-status.h \ pmpi-f90-file-interfaces.h \ pmpi-f90-removed-interfaces.h \ pmpi-f90-cptr-interfaces.h diff --git a/ompi/mpi/fortran/use-mpi-tkr/mpi-f90-status.h b/ompi/mpi/fortran/use-mpi-tkr/mpi-f90-status.h new file mode 100644 index 00000000000..9db233dc25d --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-tkr/mpi-f90-status.h @@ -0,0 +1,31 @@ +! -*- fortran -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ + + +interface MPI_Status_f082f + +subroutine MPI_Status_f082f(f08_status, f_status, ierror) + type(MPI_Status), intene(in) :: f08_status + integer, intent(out) :: f_status(MPI_STATUS_SIZE) + integer, intent(out) :: ierror +end subroutine MPI_Status_f082f + +end interface + + +interface MPI_Status_f2f08 + +subroutine MPI_Status_f2f08(f_status, f08_status, ierror) + integer, intent(in) :: f_status(MPI_STATUS_SIZE) + type(MPI_Status), intene(out) :: f08_status + integer, intent(out) :: ierror +end subroutine MPI_Status_f082f + +end interface diff --git a/ompi/mpi/fortran/use-mpi-tkr/mpi.F90 b/ompi/mpi/fortran/use-mpi-tkr/mpi.F90 index bb6a4ce651a..f45ffaa457f 100644 --- a/ompi/mpi/fortran/use-mpi-tkr/mpi.F90 +++ b/ompi/mpi/fortran/use-mpi-tkr/mpi.F90 @@ -11,7 +11,7 @@ ! Copyright (c) 2004-2005 The Regents of the University of California. ! All rights reserved. ! Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. -! Copyright (c) 2016-2019 Research Organization for Information Science +! Copyright (c) 2016-2020 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ ! @@ -30,6 +30,7 @@ module mpi include "mpif-io-constants.h" include "mpif-io-handles.h" include "mpif-sentinels.h" + include "mpif-status.h" ! The MPI attribute callback functions @@ -51,6 +52,10 @@ module mpi include "mpi-f90-interfaces.h" include "pmpi-f90-interfaces.h" +#if OMPI_FORTRAN_HAVE_BIND_C_TYPE + include "mpi-f90-status.h" + include "pmpi-f90-status.h" +#endif #if OMPI_PROVIDE_MPI_FILE_INTEFACE include "mpi-f90-file-interfaces.h" include "pmpi-f90-file-interfaces.h" diff --git a/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-status.h b/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-status.h new file mode 100644 index 00000000000..e462fc38a84 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-status.h @@ -0,0 +1,31 @@ +! -*- fortran -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ + + +interface PMPI_Status_f082f + +subroutine PMPI_Status_f082f(f08_status, f_status, ierror) + type(MPI_Status), intene(in) :: f08_status + integer, intent(out) :: f_status(MPI_STATUS_SIZE) + integer, intent(out) :: ierror +end subroutine PMPI_Status_f082f + +end interface + + +interface PMPI_Status_f2f08 + +subroutine PMPI_Status_f2f08(f_status, f08_status, ierror) + integer, intent(in) :: f_status(MPI_STATUS_SIZE) + type(MPI_Status), intene(out) :: f08_status + integer, intent(out) :: ierror +end subroutine PMPI_Status_f082f + +end interface