diff --git a/.gitignore b/.gitignore index dfa2e7c86d0..d31d774b831 100644 --- a/.gitignore +++ b/.gitignore @@ -271,6 +271,7 @@ ompi/tools/ompi_info/ompi_info ompi/tools/wrappers/mpic++-wrapper-data.txt ompi/tools/wrappers/mpicc-wrapper-data.txt +ompi/tools/wrappers/mpicc_abi-wrapper-data.txt ompi/tools/wrappers/mpifort-wrapper-data.txt ompi/tools/wrappers/ompi_wrapper_script ompi/tools/wrappers/ompi.pc @@ -534,6 +535,9 @@ docs/man # Generated C Bindings ompi/mpi/c/*_generated*.c +ompi/mpi/c/standard_*.c +ompi/mpi/c/abi.h +ompi/mpi/c/standard_abi # Generated Fortran Bindings ompi/mpi/fortran/use-mpi-f08/*_generated.F90 diff --git a/config/ompi_config_files.m4 b/config/ompi_config_files.m4 index 21d1e3eb791..f378cc3ce00 100644 --- a/config/ompi_config_files.m4 +++ b/config/ompi_config_files.m4 @@ -48,6 +48,7 @@ AC_DEFUN([OMPI_CONFIG_FILES],[ ompi/tools/ompi_info/Makefile ompi/tools/wrappers/Makefile ompi/tools/wrappers/mpicc-wrapper-data.txt + ompi/tools/wrappers/mpicc_abi-wrapper-data.txt ompi/tools/wrappers/mpic++-wrapper-data.txt ompi/tools/wrappers/mpifort-wrapper-data.txt ompi/tools/wrappers/ompi.pc diff --git a/config/ompi_configure_options.m4 b/config/ompi_configure_options.m4 index c00ead8792c..72a84353394 100644 --- a/config/ompi_configure_options.m4 +++ b/config/ompi_configure_options.m4 @@ -256,5 +256,26 @@ AM_CONDITIONAL(OMPI_OMPIO_SUPPORT, test "$ompi_want_ompio" = "1") AC_ARG_ENABLE([deprecate-mpif-h], [AS_HELP_STRING([--enable-deprecate-mpif-h], [Mark the mpif.h bindings as deprecated (default: enabled)])]) +# If the binding source files don't exist, then we need Python to generate them +AM_PATH_PYTHON([3.6],,[:]) +binding_file="${srcdir}/ompi/mpi/c/ompi_send_generated.c" +AS_IF([! test -e "$binding_file" && test "$PYTHON" = ":"], + [AC_MSG_ERROR([Open MPI requires Python >=3.6 for generating the bindings. Aborting])]) +AM_CONDITIONAL(OMPI_GENERATE_BINDINGS,[test "$PYTHON" != ":"]) + +AC_MSG_CHECKING([if want to enable standard ABI library]) +AC_ARG_ENABLE([standard-abi], + [AS_HELP_STRING([--enable-standard-abi], + [Enable building the standard ABI library (default: disabled)])]) +if test "$enable_standard_abi" = "yes"; then + AC_MSG_RESULT([yes]) + ompi_standard_abi=1 +else + AC_MSG_RESULT([no]) + ompi_standard_abi=0 +fi +AC_DEFINE_UNQUOTED([OMPI_STANDARD_ABI],[$ompi_standard_abi], + [Whether we want to build the standard ABI library]) +AM_CONDITIONAL(OMPI_STANDARD_ABI,[test "$enable_standard_abi" = "yes"]) ])dnl diff --git a/ompi/Makefile.am b/ompi/Makefile.am index f855492ef15..14857566c9b 100644 --- a/ompi/Makefile.am +++ b/ompi/Makefile.am @@ -126,36 +126,72 @@ DIST_SUBDIRS = \ $(MCA_ompi_FRAMEWORKS_SUBDIRS) \ $(MCA_ompi_FRAMEWORK_COMPONENT_ALL_SUBDIRS) -# Build the main MPI library - +noinst_LTLIBRARIES = libopen_mpi.la lib_LTLIBRARIES = lib@OMPI_LIBMPI_NAME@.la -lib@OMPI_LIBMPI_NAME@_la_SOURCES = -lib@OMPI_LIBMPI_NAME@_la_LIBADD = \ +if OMPI_STANDARD_ABI +lib_LTLIBRARIES += libmpi_abi.la +endif + +# +# ABI Refactor +# +# As required by the standard ABI, ompi must now provide libmpi_abi.la for +# ABI-specific code. Since we also want to avoid breaking the existing ompi +# ABI, the libraries in this directory are now organized as follows: +# +# +----------------------+----------------------+ +# | libmpi_abi.la | libmpi.la | +# +----------------------+----------------------+ +# | libopen_mpi.la | +# +----------------------+----------------------+ +# +# This includes a new library, libopen_mpi.la, that links in all backend code +# built in this directory or SUBDIRs of this directory. Previously everything +# was just linked directly into libmpi.la (lib@OMPI_LIBMPI_NAME@.la). +# +# libmpi_abi.la and libmpi.la both now link in libopen_mpi.la, the only +# difference between them being that one includes the standard ABI functions +# and the other the ompi-specific versions of those. +# + +# Build the Open MPI internal library +libopen_mpi_la_SOURCES = +libopen_mpi_la_LIBADD = \ datatype/libdatatype.la \ debuggers/libdebuggers.la \ + $(OMPI_TOP_BUILDDIR)/opal/lib@OPAL_LIB_NAME@.la \ + $(MCA_ompi_FRAMEWORK_LIBS) \ + $(OMPI_LIBMPI_EXTRA_LIBS) +libopen_mpi_la_DEPENDENCIES = $(libopen_mpi_la_LIBADD) + +# Build the main MPI library +lib@OMPI_LIBMPI_NAME@_la_SOURCES = +lib@OMPI_LIBMPI_NAME@_la_LIBADD = \ + libopen_mpi.la \ mpi/c/libmpi_c.la \ mpi/tool/libmpi_mpit.la \ $(c_mpi_lib) \ $(c_pmpi_lib) \ - $(mpi_fortran_base_lib) \ - $(MCA_ompi_FRAMEWORK_LIBS) \ $(OMPI_MPIEXT_C_LIBS) \ - $(OMPI_LIBMPI_EXTRA_LIBS) + $(mpi_fortran_base_lib) - -lib@OMPI_LIBMPI_NAME@_la_LIBADD += \ - $(OMPI_TOP_BUILDDIR)/opal/lib@OPAL_LIB_NAME@.la -lib@OMPI_LIBMPI_NAME@_la_DEPENDENCIES = $(lib@OMPI_LIBMPI_NAME@_la_LIBADD) lib@OMPI_LIBMPI_NAME@_la_LDFLAGS = \ -version-info $(libmpi_so_version) \ $(OMPI_LIBMPI_EXTRA_LDFLAGS) +# The MPI Standard ABI library +libmpi_abi_la_SOURCES = +libmpi_abi_la_LIBADD = \ + libopen_mpi.la \ + mpi/c/libmpi_c_abi.la + # included subdirectory Makefile.am's and appended-to variables headers = -noinst_LTLIBRARIES = include_HEADERS = EXTRA_DIST = lib@OMPI_LIBMPI_NAME@_la_SOURCES += $(headers) +dist_ompidata_DATA = +libopen_mpi_la_SOURCES += $(headers) # Conditionally install the header files diff --git a/ompi/attribute/Makefile.am b/ompi/attribute/Makefile.am index cb1193deb2f..0418c1c0cc7 100644 --- a/ompi/attribute/Makefile.am +++ b/ompi/attribute/Makefile.am @@ -22,6 +22,6 @@ headers += \ attribute/attribute.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ attribute/attribute.c \ attribute/attribute_predefined.c diff --git a/ompi/attribute/attribute.h b/ompi/attribute/attribute.h index 6292f1b0c55..7520297ebb4 100644 --- a/ompi/attribute/attribute.h +++ b/ompi/attribute/attribute.h @@ -50,6 +50,7 @@ #define OMPI_KEYVAL_PREDEFINED 0x0001 #define OMPI_KEYVAL_F77 0x0002 #define OMPI_KEYVAL_F77_INT 0x0004 +#define OMPI_KEYVAL_ABI 0x0008 BEGIN_C_DECLS @@ -136,7 +137,7 @@ struct ompi_attribute_keyval_t { copy/delete attribute functions properly and error checking */ int attr_flag; /**< flag field: contains "OMPI_KEYVAL_PREDEFINED", - "OMPI_KEYVAL_F77" */ + "OMPI_KEYVAL_F77", "OMPI_KEYVAL_ABI", etc. */ ompi_attribute_fn_ptr_union_t copy_attr_fn; /**< Copy function for the attribute */ ompi_attribute_fn_ptr_union_t delete_attr_fn; /**< Delete function for the diff --git a/ompi/class/Makefile.am b/ompi/class/Makefile.am index 7784da8ad69..ea755a11f3d 100644 --- a/ompi/class/Makefile.am +++ b/ompi/class/Makefile.am @@ -23,6 +23,5 @@ headers += \ class/ompi_seq_tracker.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ class/ompi_seq_tracker.c - diff --git a/ompi/communicator/Makefile.am b/ompi/communicator/Makefile.am index e1d25ad1026..8700ae88f48 100644 --- a/ompi/communicator/Makefile.am +++ b/ompi/communicator/Makefile.am @@ -29,14 +29,14 @@ headers += \ communicator/communicator.h \ communicator/comm_request.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ communicator/comm_init.c \ communicator/comm.c \ communicator/comm_cid.c \ communicator/comm_request.c if WANT_FT_MPI -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ communicator/ft/comm_ft.c communicator/ft/comm_ft_reliable_bcast.c communicator/ft/comm_ft_propagator.c communicator/ft/comm_ft_detector.c communicator/ft/comm_ft_revoke.c endif # WANT_FT_MPI diff --git a/ompi/dpm/Makefile.am b/ompi/dpm/Makefile.am index 02562525b9f..6e32c781ca5 100644 --- a/ompi/dpm/Makefile.am +++ b/ompi/dpm/Makefile.am @@ -17,5 +17,5 @@ EXTRA_DIST += dpm/help-dpm.txt headers += \ dpm/dpm.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ dpm/dpm.c diff --git a/ompi/errhandler/Makefile.am b/ompi/errhandler/Makefile.am index 9f94623a9ff..f8a84c249a1 100644 --- a/ompi/errhandler/Makefile.am +++ b/ompi/errhandler/Makefile.am @@ -30,7 +30,7 @@ headers += \ errhandler/errhandler.h \ errhandler/errhandler_predefined.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ errhandler/errhandler.c \ errhandler/errhandler_invoke.c \ errhandler/errhandler_predefined.c \ diff --git a/ompi/file/Makefile.am b/ompi/file/Makefile.am index e7d846ddde8..b78a18962e7 100644 --- a/ompi/file/Makefile.am +++ b/ompi/file/Makefile.am @@ -22,5 +22,5 @@ headers += \ file/file.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ file/file.c diff --git a/ompi/group/Makefile.am b/ompi/group/Makefile.am index f92a900da8d..850173c4d9f 100644 --- a/ompi/group/Makefile.am +++ b/ompi/group/Makefile.am @@ -25,7 +25,7 @@ headers += \ group/group.h \ group/group_dbg.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ group/group.c \ group/group_init.c \ group/group_set_rank.c \ diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index e838fe66061..f9ded080d7c 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -1433,6 +1433,10 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub; /* * MPI API */ +#ifndef OMPI_NO_MPI_PROTOTYPES +OMPI_DECLSPEC int MPI_Abi_supported(int *flag); +OMPI_DECLSPEC int MPI_Abi_version(int *abi_major, int *abi_minor); +OMPI_DECLSPEC int MPI_Abi_details(int *buflen, char *details, MPI_Info *info); OMPI_DECLSPEC int MPI_Abort(MPI_Comm comm, int errorcode); OMPI_DECLSPEC int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, @@ -2169,8 +2173,6 @@ OMPI_DECLSPEC int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int sou int tag, MPI_Comm comm, MPI_Status *status); OMPI_DECLSPEC int MPI_Recv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status); -OMPI_DECLSPEC int MPI_Recv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source, - int tag, MPI_Comm comm, MPI_Status *status); OMPI_DECLSPEC int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm); OMPI_DECLSPEC int MPI_Reduce_c(const void *sendbuf, void *recvbuf, MPI_Count count, MPI_Datatype datatype, @@ -3328,8 +3330,6 @@ OMPI_DECLSPEC int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int so int tag, MPI_Comm comm, MPI_Status *status); OMPI_DECLSPEC int PMPI_Recv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status); -OMPI_DECLSPEC int PMPI_Recv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source, - int tag, MPI_Comm comm, MPI_Status *status); OMPI_DECLSPEC int PMPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm); OMPI_DECLSPEC int PMPI_Reduce_c(const void *sendbuf, void *recvbuf, MPI_Count count, MPI_Datatype datatype, @@ -4092,6 +4092,9 @@ OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) #define MPI_Type_ub(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_ub, MPI_Type_get_extent) #endif +#endif /* OMPI_NO_MPI_PROTOTYPES */ + + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/ompi/instance/Makefile.am b/ompi/instance/Makefile.am index 2ee7f5d59a3..73bb25273be 100644 --- a/ompi/instance/Makefile.am +++ b/ompi/instance/Makefile.am @@ -23,4 +23,4 @@ headers += instance/instance.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += instance/instance.c +libopen_mpi_la_SOURCES += instance/instance.c diff --git a/ompi/interlib/Makefile.am b/ompi/interlib/Makefile.am index 1a40fe8b260..d80d1d3d937 100644 --- a/ompi/interlib/Makefile.am +++ b/ompi/interlib/Makefile.am @@ -25,5 +25,5 @@ headers += \ interlib/interlib.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ interlib/interlib.c diff --git a/ompi/mca/bml/r2/Makefile.am b/ompi/mca/bml/r2/Makefile.am index 0fdb3e636f3..ea4e7eccc0e 100644 --- a/ompi/mca/bml/r2/Makefile.am +++ b/ompi/mca/bml/r2/Makefile.am @@ -37,7 +37,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_bml_r2_la_SOURCES = $(r2_sources) mca_bml_r2_la_LDFLAGS = -module -avoid-version -mca_bml_r2_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_bml_r2_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_bml_r2_la_SOURCES = $(r2_sources) diff --git a/ompi/mca/coll/basic/Makefile.am b/ompi/mca/coll/basic/Makefile.am index 8e1562c12f9..ad89fe227fb 100644 --- a/ompi/mca/coll/basic/Makefile.am +++ b/ompi/mca/coll/basic/Makefile.am @@ -63,7 +63,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_basic_la_SOURCES = $(sources) mca_coll_basic_la_LDFLAGS = -module -avoid-version -mca_coll_basic_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_coll_basic_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_basic_la_SOURCES =$(sources) diff --git a/ompi/mca/coll/demo/Makefile.am b/ompi/mca/coll/demo/Makefile.am index 1246c5d4389..2ae6731cefa 100644 --- a/ompi/mca/coll/demo/Makefile.am +++ b/ompi/mca/coll/demo/Makefile.am @@ -57,7 +57,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_demo_la_SOURCES = $(sources) mca_coll_demo_la_LDFLAGS = -module -avoid-version -mca_coll_demo_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_coll_demo_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_demo_la_SOURCES = $(sources) diff --git a/ompi/mca/coll/hcoll/Makefile.am b/ompi/mca/coll/hcoll/Makefile.am index 37ec1c96c92..254a97c9a0b 100644 --- a/ompi/mca/coll/hcoll/Makefile.am +++ b/ompi/mca/coll/hcoll/Makefile.am @@ -39,7 +39,7 @@ endif mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_hcoll_la_SOURCES = $(coll_hcoll_sources) -mca_coll_hcoll_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_coll_hcoll_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(coll_hcoll_LIBS) mca_coll_hcoll_la_LDFLAGS = -module -avoid-version $(coll_hcoll_LDFLAGS) diff --git a/ompi/mca/coll/inter/Makefile.am b/ompi/mca/coll/inter/Makefile.am index ea9188cffd4..c82b9f513b9 100644 --- a/ompi/mca/coll/inter/Makefile.am +++ b/ompi/mca/coll/inter/Makefile.am @@ -34,7 +34,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_inter_la_SOURCES = $(sources) mca_coll_inter_la_LDFLAGS = -module -avoid-version -mca_coll_inter_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_coll_inter_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_inter_la_SOURCES = $(sources) diff --git a/ompi/mca/coll/libnbc/Makefile.am b/ompi/mca/coll/libnbc/Makefile.am index 4afa48cdd2c..09b30b4e172 100644 --- a/ompi/mca/coll/libnbc/Makefile.am +++ b/ompi/mca/coll/libnbc/Makefile.am @@ -72,7 +72,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_libnbc_la_SOURCES = $(sources) mca_coll_libnbc_la_LDFLAGS = -module -avoid-version -mca_coll_libnbc_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_coll_libnbc_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_libnbc_la_SOURCES =$(sources) diff --git a/ompi/mca/coll/monitoring/Makefile.am b/ompi/mca/coll/monitoring/Makefile.am index 9c6e96b1c52..cb1eed8b135 100644 --- a/ompi/mca/coll/monitoring/Makefile.am +++ b/ompi/mca/coll/monitoring/Makefile.am @@ -46,7 +46,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_monitoring_la_SOURCES = $(monitoring_sources) mca_coll_monitoring_la_LDFLAGS = -module -avoid-version -mca_coll_monitoring_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_coll_monitoring_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(OMPI_TOP_BUILDDIR)/ompi/mca/common/monitoring/libmca_common_monitoring.la noinst_LTLIBRARIES = $(component_noinst) diff --git a/ompi/mca/coll/portals4/Makefile.am b/ompi/mca/coll/portals4/Makefile.am index 8f9babbd13b..7070e01f2e6 100644 --- a/ompi/mca/coll/portals4/Makefile.am +++ b/ompi/mca/coll/portals4/Makefile.am @@ -33,7 +33,7 @@ AM_CPPFLAGS = $(coll_portals4_CPPFLAGS) mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_portals4_la_SOURCES = $(local_sources) -mca_coll_portals4_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_coll_portals4_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(coll_portals4_LIBS) mca_coll_portals4_la_LDFLAGS = -module -avoid-version $(coll_portals4_LDFLAGS) diff --git a/ompi/mca/coll/self/Makefile.am b/ompi/mca/coll/self/Makefile.am index 6b06aab4028..c4e5e13dc86 100644 --- a/ompi/mca/coll/self/Makefile.am +++ b/ompi/mca/coll/self/Makefile.am @@ -55,7 +55,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_self_la_SOURCES = $(sources) mca_coll_self_la_LDFLAGS = -module -avoid-version -mca_coll_self_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_coll_self_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_self_la_SOURCES =$(sources) diff --git a/ompi/mca/coll/sync/Makefile.am b/ompi/mca/coll/sync/Makefile.am index dad4f8f7138..d1fcfff91b5 100644 --- a/ompi/mca/coll/sync/Makefile.am +++ b/ompi/mca/coll/sync/Makefile.am @@ -46,7 +46,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_sync_la_SOURCES = $(sources) mca_coll_sync_la_LDFLAGS = -module -avoid-version -mca_coll_sync_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_coll_sync_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_sync_la_SOURCES =$(sources) diff --git a/ompi/mca/coll/tuned/Makefile.am b/ompi/mca/coll/tuned/Makefile.am index 82be7bb72aa..73f1f22a171 100644 --- a/ompi/mca/coll/tuned/Makefile.am +++ b/ompi/mca/coll/tuned/Makefile.am @@ -61,7 +61,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_tuned_la_SOURCES = $(sources) mca_coll_tuned_la_LDFLAGS = -module -avoid-version -mca_coll_tuned_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_coll_tuned_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_tuned_la_SOURCES =$(sources) diff --git a/ompi/mca/coll/ucc/Makefile.am b/ompi/mca/coll/ucc/Makefile.am index 8d2f4c7c3eb..95ec95401ac 100644 --- a/ompi/mca/coll/ucc/Makefile.am +++ b/ompi/mca/coll/ucc/Makefile.am @@ -50,7 +50,7 @@ endif mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_ucc_la_SOURCES = $(coll_ucc_sources) -mca_coll_ucc_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_coll_ucc_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(coll_ucc_LIBS) mca_coll_ucc_la_LDFLAGS = -module -avoid-version $(coll_ucc_LDFLAGS) diff --git a/ompi/mca/common/monitoring/Makefile.am b/ompi/mca/common/monitoring/Makefile.am index 28f4d442d27..d0dfa439f7d 100644 --- a/ompi/mca/common/monitoring/Makefile.am +++ b/ompi/mca/common/monitoring/Makefile.am @@ -34,7 +34,7 @@ endif ompi_monitoring_prof_la_LDFLAGS= \ -module -avoid-version -shared $(WRAPPER_EXTRA_LDFLAGS) ompi_monitoring_prof_la_LIBADD = \ - $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(top_builddir)/ompi/libopen-mpi.la \ $(top_builddir)/opal/lib@OPAL_LIB_NAME@.la if OPAL_INSTALL_BINARIES diff --git a/ompi/mca/fbtl/ime/Makefile.am b/ompi/mca/fbtl/ime/Makefile.am index 2dfebbcb0c0..41908982b5e 100644 --- a/ompi/mca/fbtl/ime/Makefile.am +++ b/ompi/mca/fbtl/ime/Makefile.am @@ -30,7 +30,7 @@ AM_CPPFLAGS = $(fbtl_ime_CPPFLAGS) mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_fbtl_ime_la_SOURCES = $(fbtl_ime_sources) -mca_fbtl_ime_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_fbtl_ime_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(fbtl_ime_LIBS) mca_fbtl_ime_la_LDFLAGS = -module -avoid-version $(fbtl_ime_LDFLAGS) diff --git a/ompi/mca/fbtl/posix/Makefile.am b/ompi/mca/fbtl/posix/Makefile.am index 1ce19cb09b7..37a98c30e48 100644 --- a/ompi/mca/fbtl/posix/Makefile.am +++ b/ompi/mca/fbtl/posix/Makefile.am @@ -34,7 +34,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_fbtl_posix_la_SOURCES = $(sources) mca_fbtl_posix_la_LDFLAGS = -module -avoid-version -mca_fbtl_posix_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_fbtl_posix_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(OMPI_TOP_BUILDDIR)/ompi/mca/common/ompio/libmca_common_ompio.la noinst_LTLIBRARIES = $(component_noinst) diff --git a/ompi/mca/fs/ime/Makefile.am b/ompi/mca/fs/ime/Makefile.am index db15704e732..9afbc08115a 100644 --- a/ompi/mca/fs/ime/Makefile.am +++ b/ompi/mca/fs/ime/Makefile.am @@ -37,7 +37,7 @@ AM_CPPFLAGS = $(fs_ime_CPPFLAGS) mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_fs_ime_la_SOURCES = $(fs_ime_sources) -mca_fs_ime_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_fs_ime_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(fs_ime_LIBS) mca_fs_ime_la_LDFLAGS = -module -avoid-version $(fs_ime_LDFLAGS) diff --git a/ompi/mca/fs/lustre/Makefile.am b/ompi/mca/fs/lustre/Makefile.am index bf4f487de7a..9f862506c7d 100644 --- a/ompi/mca/fs/lustre/Makefile.am +++ b/ompi/mca/fs/lustre/Makefile.am @@ -43,7 +43,7 @@ AM_CPPFLAGS = $(fs_lustre_CPPFLAGS) mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_fs_lustre_la_SOURCES = $(fs_lustre_sources) -mca_fs_lustre_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_fs_lustre_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(fs_lustre_LIBS) mca_fs_lustre_la_LDFLAGS = -module -avoid-version $(fs_lustre_LDFLAGS) diff --git a/ompi/mca/fs/ufs/Makefile.am b/ompi/mca/fs/ufs/Makefile.am index 50201a80ca2..aa2e4b728fd 100644 --- a/ompi/mca/fs/ufs/Makefile.am +++ b/ompi/mca/fs/ufs/Makefile.am @@ -34,7 +34,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_fs_ufs_la_SOURCES = $(sources) mca_fs_ufs_la_LDFLAGS = -module -avoid-version -mca_fs_ufs_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_fs_ufs_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_fs_ufs_la_SOURCES = $(sources) diff --git a/ompi/mca/hook/comm_method/hook_comm_method_fns.c b/ompi/mca/hook/comm_method/hook_comm_method_fns.c index b1ab8c200b3..303538ac15f 100644 --- a/ompi/mca/hook/comm_method/hook_comm_method_fns.c +++ b/ompi/mca/hook/comm_method/hook_comm_method_fns.c @@ -511,6 +511,7 @@ ompi_report_comm_methods(int called_from_location) free(p); } +#if 0 MPI_Datatype mydt; MPI_Op myop; MPI_Type_contiguous(sizeof(comm_method_string_conversion_t), MPI_BYTE, &mydt); @@ -521,6 +522,7 @@ ompi_report_comm_methods(int called_from_location) leader_comm->c_coll->coll_allreduce_module); MPI_Op_free(&myop); MPI_Type_free(&mydt); +#endif // Sort communication method string arrays after reduction qsort(&comm_method_string_conversion.str[1], diff --git a/ompi/mca/mtl/ofi/Makefile.am b/ompi/mca/mtl/ofi/Makefile.am index 5842abd3018..fa46bba2d56 100644 --- a/ompi/mca/mtl/ofi/Makefile.am +++ b/ompi/mca/mtl/ofi/Makefile.am @@ -80,7 +80,7 @@ mca_mtl_ofi_la_SOURCES = $(mtl_ofi_sources) mca_mtl_ofi_la_LDFLAGS = \ $(mtl_ofi_LDFLAGS) \ -module -avoid-version -mca_mtl_ofi_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_mtl_ofi_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_NAME@mca_common_ofi.la \ $(mtl_ofi_LIBS) diff --git a/ompi/mca/mtl/portals4/Makefile.am b/ompi/mca/mtl/portals4/Makefile.am index df3f13a5586..437b9343d24 100644 --- a/ompi/mca/mtl/portals4/Makefile.am +++ b/ompi/mca/mtl/portals4/Makefile.am @@ -60,7 +60,7 @@ endif mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_mtl_portals4_la_SOURCES = $(local_sources) -mca_mtl_portals4_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_mtl_portals4_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(mtl_portals4_LIBS) mca_mtl_portals4_la_LDFLAGS = -module -avoid-version $(mtl_portals4_LDFLAGS) diff --git a/ompi/mca/mtl/psm2/Makefile.am b/ompi/mca/mtl/psm2/Makefile.am index 8b889bf726a..af1878c4f08 100644 --- a/ompi/mca/mtl/psm2/Makefile.am +++ b/ompi/mca/mtl/psm2/Makefile.am @@ -59,7 +59,7 @@ endif mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_mtl_psm2_la_SOURCES = $(mtl_psm2_sources) -mca_mtl_psm2_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_mtl_psm2_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(mtl_psm2_LIBS) mca_mtl_psm2_la_LDFLAGS = -module -avoid-version $(mtl_psm2_LDFLAGS) diff --git a/ompi/mca/op/avx/Makefile.am b/ompi/mca/op/avx/Makefile.am index b1d84d90b33..022c2dc7da0 100644 --- a/ompi/mca/op/avx/Makefile.am +++ b/ompi/mca/op/avx/Makefile.am @@ -86,7 +86,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_op_avx_la_SOURCES = $(sources) mca_op_avx_la_LIBADD = $(specialized_op_libs) -mca_op_avx_la_LDFLAGS = -module -avoid-version $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_op_avx_la_LDFLAGS = -module -avoid-version $(top_builddir)/ompi/libopen-mpi.la # Specific information for static builds. diff --git a/ompi/mca/op/example/Makefile.am b/ompi/mca/op/example/Makefile.am index e0990e52716..5b2f80ee706 100644 --- a/ompi/mca/op/example/Makefile.am +++ b/ompi/mca/op/example/Makefile.am @@ -71,7 +71,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component) mca_op_example_la_SOURCES = $(component_sources) mca_op_example_la_LDFLAGS = -module -avoid-version -mca_op_example_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_op_example_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la # Specific information for static builds. # diff --git a/ompi/mca/osc/monitoring/Makefile.am b/ompi/mca/osc/monitoring/Makefile.am index a90ce38c6e3..2567b2a4b54 100644 --- a/ompi/mca/osc/monitoring/Makefile.am +++ b/ompi/mca/osc/monitoring/Makefile.am @@ -31,7 +31,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_osc_monitoring_la_SOURCES = $(monitoring_sources) mca_osc_monitoring_la_LDFLAGS = -module -avoid-version -mca_osc_monitoring_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_osc_monitoring_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(OMPI_TOP_BUILDDIR)/ompi/mca/common/monitoring/libmca_common_monitoring.la noinst_LTLIBRARIES = $(component_noinst) diff --git a/ompi/mca/osc/portals4/Makefile.am b/ompi/mca/osc/portals4/Makefile.am index a7f5a061254..3971fafa7ac 100644 --- a/ompi/mca/osc/portals4/Makefile.am +++ b/ompi/mca/osc/portals4/Makefile.am @@ -36,7 +36,7 @@ endif mcacomponentdir = $(pkglibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_osc_portals4_la_SOURCES = $(portals4_sources) -mca_osc_portals4_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_osc_portals4_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(osc_portals4_LIBS) mca_osc_portals4_la_LDFLAGS = -module -avoid-version $(osc_portals4_LDFLAGS) diff --git a/ompi/mca/osc/rdma/Makefile.am b/ompi/mca/osc/rdma/Makefile.am index 4757ce6aa93..0af844602c1 100644 --- a/ompi/mca/osc/rdma/Makefile.am +++ b/ompi/mca/osc/rdma/Makefile.am @@ -63,7 +63,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_osc_rdma_la_SOURCES = $(rdma_sources) mca_osc_rdma_la_LDFLAGS = -module -avoid-version -mca_osc_rdma_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_osc_rdma_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_osc_rdma_la_SOURCES = $(rdma_sources) diff --git a/ompi/mca/osc/sm/Makefile.am b/ompi/mca/osc/sm/Makefile.am index 01d230d7bf3..db6aedf13f8 100644 --- a/ompi/mca/osc/sm/Makefile.am +++ b/ompi/mca/osc/sm/Makefile.am @@ -34,7 +34,7 @@ endif mcacomponentdir = $(pkglibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_osc_sm_la_SOURCES = $(sm_sources) -mca_osc_sm_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_osc_sm_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(osc_sm_LIBS) mca_osc_sm_la_LDFLAGS = -module -avoid-version $(osc_sm_LDFLAGS) diff --git a/ompi/mca/osc/ucx/Makefile.am b/ompi/mca/osc/ucx/Makefile.am index 77184d83584..4c3fbd6da91 100644 --- a/ompi/mca/osc/ucx/Makefile.am +++ b/ompi/mca/osc/ucx/Makefile.am @@ -34,7 +34,7 @@ endif mcacomponentdir = $(pkglibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_osc_ucx_la_SOURCES = $(ucx_sources) -mca_osc_ucx_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la $(osc_ucx_LIBS) \ +mca_osc_ucx_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la $(osc_ucx_LIBS) \ $(OPAL_TOP_BUILDDIR)/opal/mca/common/ucx/lib@OPAL_LIB_NAME@mca_common_ucx.la mca_osc_ucx_la_LDFLAGS = -module -avoid-version $(osc_ucx_LDFLAGS) diff --git a/ompi/mca/part/persist/Makefile.am b/ompi/mca/part/persist/Makefile.am index fab2975e92b..910ea0a59ad 100644 --- a/ompi/mca/part/persist/Makefile.am +++ b/ompi/mca/part/persist/Makefile.am @@ -42,7 +42,7 @@ local_sources = \ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_part_persist_la_SOURCES = $(local_sources) -mca_part_persist_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_part_persist_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(part_persist_LIBS) mca_part_persist_la_LDFLAGS = -module -avoid-version $(part_persist_LDFLAGS) diff --git a/ompi/mca/pml/cm/Makefile.am b/ompi/mca/pml/cm/Makefile.am index d1a43fe8841..fa7327d6372 100644 --- a/ompi/mca/pml/cm/Makefile.am +++ b/ompi/mca/pml/cm/Makefile.am @@ -43,7 +43,7 @@ local_sources = \ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_pml_cm_la_SOURCES = $(local_sources) -mca_pml_cm_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_pml_cm_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(pml_cm_LIBS) mca_pml_cm_la_LDFLAGS = -module -avoid-version $(pml_cm_LDFLAGS) diff --git a/ompi/mca/pml/example/Makefile.am b/ompi/mca/pml/example/Makefile.am index 4c3588848a9..2ea3b1bb269 100644 --- a/ompi/mca/pml/example/Makefile.am +++ b/ompi/mca/pml/example/Makefile.am @@ -53,7 +53,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_pml_example_la_SOURCES = $(local_sources) mca_pml_example_la_LDFLAGS = -module -avoid-version -mca_pml_example_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_pml_example_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_pml_example_la_SOURCES = $(local_sources) diff --git a/ompi/mca/pml/monitoring/Makefile.am b/ompi/mca/pml/monitoring/Makefile.am index 431f5be9ba9..6e4215de807 100644 --- a/ompi/mca/pml/monitoring/Makefile.am +++ b/ompi/mca/pml/monitoring/Makefile.am @@ -32,7 +32,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_pml_monitoring_la_SOURCES = $(monitoring_sources) mca_pml_monitoring_la_LDFLAGS = -module -avoid-version -mca_pml_monitoring_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_pml_monitoring_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(OMPI_TOP_BUILDDIR)/ompi/mca/common/monitoring/libmca_common_monitoring.la noinst_LTLIBRARIES = $(component_noinst) diff --git a/ompi/mca/pml/ob1/Makefile.am b/ompi/mca/pml/ob1/Makefile.am index 38487f5a2e6..4a84f9ec69b 100644 --- a/ompi/mca/pml/ob1/Makefile.am +++ b/ompi/mca/pml/ob1/Makefile.am @@ -72,7 +72,7 @@ mcacomponent_LTLIBRARIES = $(component_install) mca_pml_ob1_la_SOURCES = $(ob1_sources) mca_pml_ob1_la_LDFLAGS = -module -avoid-version -mca_pml_ob1_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_pml_ob1_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_pml_ob1_la_SOURCES = $(ob1_sources) diff --git a/ompi/mca/pml/ucx/Makefile.am b/ompi/mca/pml/ucx/Makefile.am index fe6c8e47c35..04ab6a445a0 100644 --- a/ompi/mca/pml/ucx/Makefile.am +++ b/ompi/mca/pml/ucx/Makefile.am @@ -37,7 +37,7 @@ endif mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_pml_ucx_la_SOURCES = $(local_sources) -mca_pml_ucx_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la $(pml_ucx_LIBS) \ +mca_pml_ucx_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la $(pml_ucx_LIBS) \ $(OPAL_TOP_BUILDDIR)/opal/mca/common/ucx/lib@OPAL_LIB_NAME@mca_common_ucx.la mca_pml_ucx_la_LDFLAGS = -module -avoid-version $(pml_ucx_LDFLAGS) diff --git a/ompi/mca/pml/v/Makefile.am b/ompi/mca/pml/v/Makefile.am index 3fd61be21df..e68c373e09a 100644 --- a/ompi/mca/pml/v/Makefile.am +++ b/ompi/mca/pml/v/Makefile.am @@ -32,7 +32,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_pml_v_la_SOURCES = $(local_sources) mca_pml_v_la_LDFLAGS = -module -avoid-version -mca_pml_v_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_pml_v_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_pml_v_la_SOURCES = $(local_sources) diff --git a/ompi/mca/topo/basic/Makefile.am b/ompi/mca/topo/basic/Makefile.am index 9ed7b26dadd..907f5ffa282 100644 --- a/ompi/mca/topo/basic/Makefile.am +++ b/ompi/mca/topo/basic/Makefile.am @@ -37,7 +37,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component) mca_topo_basic_la_SOURCES = $(component_sources) mca_topo_basic_la_LDFLAGS = -module -avoid-version -mca_topo_basic_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_topo_basic_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(lib) libmca_topo_basic_la_SOURCES = $(lib_sources) diff --git a/ompi/mca/topo/example/Makefile.am b/ompi/mca/topo/example/Makefile.am index 22acd1a360f..29e78f455a0 100644 --- a/ompi/mca/topo/example/Makefile.am +++ b/ompi/mca/topo/example/Makefile.am @@ -46,7 +46,7 @@ mcacomponentdir = $(pkglibdir) mcacomponent_LTLIBRARIES = $(component) mca_topo_example_la_SOURCES = $(component_sources) mca_topo_example_la_LDFLAGS = -module -avoid-version -mca_topo_example_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_topo_example_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(lib) libmca_topo_example_la_SOURCES = $(lib_sources) diff --git a/ompi/mca/topo/treematch/Makefile.am b/ompi/mca/topo/treematch/Makefile.am index e17d4e18085..eeb694a136f 100644 --- a/ompi/mca/topo/treematch/Makefile.am +++ b/ompi/mca/topo/treematch/Makefile.am @@ -43,7 +43,7 @@ mcacomponentdir = $(pkglibdir) mcacomponent_LTLIBRARIES = $(component) mca_topo_treematch_la_SOURCES = $(component_sources) mca_topo_treematch_la_LDFLAGS = -module -avoid-version $(topo_treematch_LDFLAGS) -mca_topo_treematch_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la $(topo_treematch_LIBS) +mca_topo_treematch_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la $(topo_treematch_LIBS) noinst_LTLIBRARIES = $(lib) libmca_topo_treematch_la_SOURCES = $(lib_sources) diff --git a/ompi/mca/vprotocol/example/Makefile.am b/ompi/mca/vprotocol/example/Makefile.am index 64ec3e4cca0..2d00dbbb1fc 100644 --- a/ompi/mca/vprotocol/example/Makefile.am +++ b/ompi/mca/vprotocol/example/Makefile.am @@ -37,7 +37,7 @@ local_sources = \ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_vprotocol_example_la_SOURCES = $(local_sources) -mca_vprotocol_example_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_vprotocol_example_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la mca_vprotocol_example_la_CFLAGS = mca_vprotocol_example_la_LDFLAGS = -module -avoid-version diff --git a/ompi/mca/vprotocol/pessimist/Makefile.am b/ompi/mca/vprotocol/pessimist/Makefile.am index f037b9f6d00..8f931fccb8e 100644 --- a/ompi/mca/vprotocol/pessimist/Makefile.am +++ b/ompi/mca/vprotocol/pessimist/Makefile.am @@ -50,7 +50,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_vprotocol_pessimist_la_SOURCES = $(local_sources) mca_vprotocol_pessimist_la_LDFLAGS = -module -avoid-version -mca_vprotocol_pessimist_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_vprotocol_pessimist_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_vprotocol_pessimist_la_SOURCES = $(local_sources) diff --git a/ompi/message/Makefile.am b/ompi/message/Makefile.am index 8fc7c07e4cd..b5650a5f81d 100644 --- a/ompi/message/Makefile.am +++ b/ompi/message/Makefile.am @@ -24,5 +24,5 @@ headers += \ message/message.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ message/message.c diff --git a/ompi/mpi/bindings/ompi_bindings/c.py b/ompi/mpi/bindings/ompi_bindings/c.py index 362f481d11b..c9ba51af75a 100644 --- a/ompi/mpi/bindings/ompi_bindings/c.py +++ b/ompi/mpi/bindings/ompi_bindings/c.py @@ -137,18 +137,57 @@ def generate_comm_convert_fn_intern_to_abi(self): def generate_info_convert_fn(self): self.generic_convert(ConvertFuncs.INFO, 'info', 'MPI_Info', consts.RESERVED_INFOS) + def generate_info_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.INFO, 'info', 'MPI_Info', consts.RESERVED_INFOS) + + def generate_file_convert_fn(self): + self.generic_convert(ConvertFuncs.FILE, 'file', 'MPI_File', consts.RESERVED_FILES) + def generate_file_convert_fn_intern_to_abi(self): - self.generic_convert_reverse(ConvertFuncs.FILE, 'file', 'MPI_File', consts.RESERVED_FILES) + self.generic_convert_reverse(ConvertOMPIToStandard.FILE, 'file', 'MPI_File', consts.RESERVED_FILES) def generate_datatype_convert_fn(self): self.generic_convert(ConvertFuncs.DATATYPE, 'datatype', 'MPI_Datatype', consts.PREDEFINED_DATATYPES) + def generate_datatype_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.DATATYPE, 'datatype', 'MPI_Datatype', consts.PREDEFINED_DATATYPES) + + def generate_errhandler_convert_fn(self): + self.generic_convert(ConvertFuncs.ERRHANDLER, 'errorhandler', 'MPI_Errhandler', consts.RESERVED_ERRHANDLERS) + + def generate_errhandler_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.ERRHANDLER, 'errorhandler', 'MPI_Errhandler', consts.RESERVED_ERRHANDLERS) + + def generate_group_convert_fn(self): + self.generic_convert(ConvertFuncs.GROUP, 'group', 'MPI_Group', consts.RESERVED_GROUPS) + + def generate_group_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.GROUP, 'group', 'MPI_Group', consts.RESERVED_GROUPS) + + def generate_message_convert_fn(self): + self.generic_convert(ConvertFuncs.MESSAGE, 'message', 'MPI_Message', consts.RESERVED_MESSAGES) + + def generate_message_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.MESSAGE, 'message', 'MPI_Message', consts.RESERVED_MESSAGES) + def generate_op_convert_fn(self): self.generic_convert(ConvertFuncs.OP, 'op', 'MPI_Op', consts.COLLECTIVE_OPERATIONS) + def generate_op_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.OP, 'op', 'MPI_Op', consts.RESERVED_OPS) + + def generate_session_convert_fn(self): + self.generic_convert(ConvertFuncs.SESSION, 'session', 'MPI_Session', consts.RESERVED_SESSIONS) + + def generate_session_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.SESSION, 'session', 'MPI_Session', consts.RESERVED_SESSIONS) + def generate_win_convert_fn(self): self.generic_convert(ConvertFuncs.WIN, 'win', 'MPI_Win', consts.RESERVED_WINDOWS) + def generate_win_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.WIN, 'win', 'MPI_Win', consts.RESERVED_WINDOWS) + def generate_pointer_convert_fn(self, type_, fn_name, constants): abi_type = self.mangle_name(type_) self.dump(f'{consts.INLINE_ATTRS} void {fn_name}({abi_type} *ptr)') @@ -168,20 +207,40 @@ def generate_pointer_convert_fn(self, type_, fn_name, constants): def generate_request_convert_fn(self): self.generate_pointer_convert_fn('MPI_Request', ConvertFuncs.REQUEST, consts.RESERVED_REQUESTS) - def generate_file_convert_fn(self): - self.generate_pointer_convert_fn('MPI_File', ConvertFuncs.FILE, consts.RESERVED_FILES) + def generate_request_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.REQUEST, 'request', 'MPI_Request', consts.RESERVED_REQUESTS) + +# def generate_file_convert_fn(self): +# self.generate_pointer_convert_fn('MPI_File', ConvertFuncs.FILE, consts.RESERVED_FILES) def generate_status_convert_fn(self): type_ = 'MPI_Status' abi_type = self.mangle_name(type_) - self.dump(f'{consts.INLINE_ATTRS} void {ConvertFuncs.STATUS}({abi_type} *out, {type_} *inp)') + self.dump(f'{consts.INLINE_ATTRS} void {ConvertFuncs.STATUS}({type_} *out, {abi_type} *inp)') self.dump('{') + self.dump(' void *ptr = &out->_ucount;') self.dump(' out->MPI_SOURCE = inp->MPI_SOURCE;') self.dump(' out->MPI_TAG = inp->MPI_TAG;') + self.dump(' out->_cancelled = inp->MPI_Internal[0];') + self.dump(' memcpy(ptr, &inp->MPI_Internal[1],sizeof(out->_ucount));') self.dump(f' out->MPI_ERROR = {ConvertFuncs.ERROR_CLASS}(inp->MPI_ERROR);') # Ignoring the private fields for now self.dump('}') + def generate_status_convert_fn_intern_to_abi(self): + type_ = 'MPI_Status' + abi_type = self.mangle_name(type_) + self.dump(f'{consts.INLINE_ATTRS} void {ConvertOMPIToStandard.STATUS}({abi_type} *out, {type_} *inp)') + self.dump('{') + self.dump(' void *ptr = &out->MPI_Internal[1];') + self.dump(' out->MPI_SOURCE = inp->MPI_SOURCE;') + self.dump(' out->MPI_TAG = inp->MPI_TAG;') + self.dump(' out->MPI_Internal[0] =inp->_cancelled;') + self.dump(' memcpy(ptr, &inp->_ucount,sizeof(inp->_ucount));') +# self.dump(f' out->MPI_ERROR = {ConvertOMPIToStandard.ERROR_CLASS}(inp->MPI_ERROR);') + # Ignoring the private fields for now + self.dump('}') + def define(self, type_, name, value): self.dump(f'#define {name} OMPI_CAST_CONSTANT({type_}, {value})') @@ -217,12 +276,17 @@ def dump_header(self): self.dump() self.define_all('MPI_Datatype', consts.PREDEFINED_DATATYPES) - self.define_all('MPI_Op', COLLECTIVE_OPERATIONS) + self.define_all('MPI_Op', consts.COLLECTIVE_OPERATIONS) + self.define_all('MPI_Op', consts.RESERVED_OPS) self.define_all('MPI_Comm', consts.RESERVED_COMMUNICATORS) + self.define_all('MPI_Errhandler', consts.RESERVED_ERRHANDLERS) + self.define_all('MPI_Group', consts.RESERVED_GROUPS) self.define_all('MPI_Request', consts.RESERVED_REQUESTS) + self.define_all('MPI_Session', consts.RESERVED_SESSIONS) self.define_all('MPI_Win', consts.RESERVED_WINDOWS) self.define_all('MPI_Info', consts.RESERVED_INFOS) self.define_all('MPI_File', consts.RESERVED_FILES) + self.define_all('MPI_Message', consts.RESERVED_MESSAGES) for name, value in consts.VARIOUS_CONSTANTS.items(): self.dump(f'#define {self.mangle_name(name)} {value}') @@ -251,28 +315,69 @@ def dump_header(self): int MPI_SOURCE; int MPI_TAG; int MPI_ERROR; - int mpi_abi_private[5]; + int MPI_Internal[5]; };""") self.dump(f'typedef struct MPI_Status_ABI {self.mangle_name("MPI_Status")};') self.dump() + # user functions + self.dump('typedef int (MPI_Copy_function)(MPI_Comm_ABI_INTERNAL, int, void *, void *, void *, int *);') + self.dump('typedef int (MPI_Delete_function)(MPI_Comm_ABI_INTERNAL, int, void *, void *);') +# +# generate prototypes for user call back functions +# + for handle in consts.C_ATTRIBUTE_OBJS: + prefix, suffix = handle.split('_') + copy_callback_func_name = f'{handle}_copy_attr_function' + copy_callback_func_name = f'{self.mangle_name(copy_callback_func_name)}' + delete_callback_func_name = f'{handle}_delete_attr_function' + delete_callback_func_name = f'{self.mangle_name(delete_callback_func_name)}' + # + # stupid MPI standard naming consistency + # + if handle == 'MPI_Type': + obj_arg_type = f'{self.mangle_name("MPI_Datatype")}' + else: + obj_arg_type = f'{self.mangle_name(handle)}' + obj_arg_name = f'old{suffix}'.lower() + obj_arg = f'{obj_arg_type} {obj_arg_name}' + keyval_arg = f'int {suffix}_keyval'.lower() + self.dump(f'typedef int ({copy_callback_func_name})({obj_arg}, {keyval_arg}, void *, void *, void *,int *);') + self.dump(f'typedef int ({delete_callback_func_name})({obj_arg}, {keyval_arg}, void *, void *);') + # Function signatures for sig in self.signatures: self.dump(f'{sig};') self.dump('int MPI_Abi_details(int *buflen, char *details, MPI_Info *info);') self.dump('int MPI_Abi_supported(int *flag);') self.dump('int MPI_Abi_version(int *abi_major, int *abi_minor);') + if not self.external: # Now generate the conversion code self.generate_error_convert_fn() self.generate_comm_convert_fn() self.generate_comm_convert_fn_intern_to_abi() self.generate_info_convert_fn() + self.generate_info_convert_fn_intern_to_abi() self.generate_file_convert_fn() + self.generate_file_convert_fn_intern_to_abi() + self.generate_group_convert_fn() + self.generate_group_convert_fn_intern_to_abi() self.generate_datatype_convert_fn() + self.generate_datatype_convert_fn_intern_to_abi() + self.generate_errhandler_convert_fn() + self.generate_errhandler_convert_fn_intern_to_abi() + self.generate_message_convert_fn() + self.generate_message_convert_fn_intern_to_abi() self.generate_op_convert_fn() + self.generate_op_convert_fn_intern_to_abi() + self.generate_session_convert_fn() + self.generate_session_convert_fn_intern_to_abi() self.generate_win_convert_fn() + self.generate_win_convert_fn_intern_to_abi() self.generate_request_convert_fn() + self.generate_request_convert_fn_intern_to_abi() self.generate_status_convert_fn() + self.generate_status_convert_fn_intern_to_abi() self.dump(""" #if defined(c_plusplus) || defined(__cplusplus) @@ -292,7 +397,7 @@ def print_profiling_header(fn_name, out): out.dump('#endif') -def print_cdefs_for_bigcount(fn_name, out, enable_count=False): +def print_cdefs_for_bigcount(out, enable_count=False): if enable_count: out.dump('#undef OMPI_BIGCOUNT_SRC') out.dump('#define OMPI_BIGCOUNT_SRC 1') @@ -300,18 +405,28 @@ def print_cdefs_for_bigcount(fn_name, out, enable_count=False): out.dump('#undef OMPI_BIGCOUNT_SRC') out.dump('#define OMPI_BIGCOUNT_SRC 0') +def print_cdefs_for_abi(out, abi_type='ompi'): + if abi_type == 'ompi': + out.dump('#undef OMPI_ABI_SRC') + out.dump('#define OMPI_ABI_SRC 0') + else: + out.dump('#undef OMPI_ABI_SRC') + out.dump('#define OMPI_ABI_SRC 1') + def ompi_abi(base_name, template, out): """Generate the OMPI ABI functions.""" template.print_header(out) print_profiling_header(base_name, out) - print_cdefs_for_bigcount(base_name, out) + print_cdefs_for_bigcount(out) + print_cdefs_for_abi(out) out.dump(template.prototype.signature(base_name, abi_type='ompi')) template.print_body(func_name=base_name, out=out) # Check if we need to generate the bigcount interface if util.prototype_has_bigcount(template.prototype): base_name_c = f'{base_name}_c' print_profiling_header(base_name_c, out) - print_cdefs_for_bigcount(base_name_c, out, enable_count=True) + print_cdefs_for_bigcount(out, enable_count=True) + print_cdefs_for_abi(out) out.dump(template.prototype.signature(base_name_c, abi_type='ompi', enable_count=True)) template.print_body(func_name=base_name_c, out=out) @@ -323,18 +438,40 @@ def standard_abi(base_name, template, out): """Generate the standard ABI functions.""" template.print_header(out) out.dump(f'#include "{ABI_INTERNAL_HEADER}"') + print_cdefs_for_abi(out,abi_type='standard') + + # If any parameters are pointers to user callback functions, generate code + # for callback wrappers + if util.prototype_needs_callback_wrappers(template.prototype): + params = [param.construct(abi_type='standard') for param in template.prototype.params] + for param in params: + if param.callback_wrapper_code: + lines = [] + lines.extend(param.callback_wrapper_code) + for line in lines: + out.dump(line) # Static internal function (add a random component to avoid conflicts) internal_name = f'ompi_abi_{template.prototype.name}' + print_cdefs_for_bigcount(out) + print_cdefs_for_abi(out, abi_type='standard') internal_sig = template.prototype.signature(internal_name, abi_type='ompi', - enable_count=True) + enable_count=False) out.dump(consts.INLINE_ATTRS, internal_sig) template.print_body(func_name=base_name, out=out) - - def generate_function(prototype, fn_name, internal_fn, enable_count=False): + if util.prototype_has_bigcount(template.prototype): + internal_name = f'ompi_abi_{template.prototype.name}_c' + print_cdefs_for_bigcount(out, enable_count=True) + print_cdefs_for_abi(out, abi_type='standard') + internal_sig = template.prototype.signature(internal_name, abi_type='ompi', + enable_count=True) + out.dump(consts.INLINE_ATTRS, internal_sig) + template.print_body(func_name=base_name, out=out) + + def generate_function(prototype, fn_name, internal_fn, out, enable_count=False): """Generate a function for the standard ABI.""" - print_profiling_header(fn_name) - print_cdefs_for_bigcount(fn_name,enable_count) + print_profiling_header(fn_name,out) +# print_cdefs_for_bigcount(out, enable_count) # Handle type conversions and arguments params = [param.construct(abi_type='standard') for param in prototype.params] @@ -344,6 +481,7 @@ def generate_function(prototype, fn_name, internal_fn, enable_count=False): return_type = prototype.return_type.construct(abi_type='standard') lines.append(f'{return_type.tmp_type_text()} ret_value;') for param in params: +# print("param = " + str(param) + " " + str(param.argument)) if param.init_code: lines.extend(param.init_code) pass_args = ', '.join(param.argument for param in params) @@ -359,10 +497,12 @@ def generate_function(prototype, fn_name, internal_fn, enable_count=False): out.dump(line) out.dump('}') - generate_function(template.prototype, base_name, internal_name) + internal_name = f'ompi_abi_{template.prototype.name}' + generate_function(template.prototype, base_name, internal_name, out) if util.prototype_has_bigcount(template.prototype): base_name_c = f'{base_name}_c' - generate_function(template.prototype, base_name_c, internal_name, + internal_name = f'ompi_abi_{template.prototype.name}_c' + generate_function(template.prototype, base_name_c, internal_name, out, enable_count=True) diff --git a/ompi/mpi/bindings/ompi_bindings/c_type.py b/ompi/mpi/bindings/ompi_bindings/c_type.py index 532dfb88e37..ec324454471 100644 --- a/ompi/mpi/bindings/ompi_bindings/c_type.py +++ b/ompi/mpi/bindings/ompi_bindings/c_type.py @@ -8,8 +8,8 @@ # $HEADER$ """C type definitions.""" from abc import ABC, abstractmethod -from ompi_bindings.consts import ConvertFuncs, ConvertOMPIToStandard - +from ompi_bindings.consts import ConvertFuncs, ConvertOMPIToStandard, IGNORED_STATUS_HANDLES +from ompi_bindings import util class Type(ABC): """Type representation.""" @@ -24,7 +24,7 @@ def __init__(self, type_name, name=None, self.type = type_name self.name = name self.count_param = count_param - self.mangle_name = mangle_name + self.mangle_name = util.abi_internal_name @staticmethod def construct(abi_type, type_name, **kwargs): @@ -32,6 +32,7 @@ def construct(abi_type, type_name, **kwargs): if abi_type == 'ompi': return Type.PARAMS_OMPI_ABI[type_name](type_name, **kwargs) elif abi_type == 'standard': +# print("Checkint oug type " + str(type_name)) return Type.PARAMS_STANDARD_ABI[type_name](type_name, **kwargs) else: raise RuntimeError(f'invalid ABI type {abi_type}') @@ -43,6 +44,7 @@ def wrapper(class_): if 'ompi' in abi_type: Type.PARAMS_OMPI_ABI[type_name] = class_ if 'standard' in abi_type: +# print("Adding type " + str(type_name) + " to PARAMS_STANDARD_ABI") Type.PARAMS_STANDARD_ABI[type_name] = class_ return class_ return wrapper @@ -82,6 +84,10 @@ def tmp_type_text(self, enable_count=False): def parameter(self, enable_count=False, **kwargs): return f'{self.type_text(enable_count=enable_count)} {self.name}' + @property + def callback_wrapper_code(self): + """Return True if this parameter has callback wrapper code to generate.""" + return False @Type.add_type('ERROR_CLASS') class TypeErrorClass(Type): @@ -340,6 +346,12 @@ class TypeDatatype(Type): def type_text(self, enable_count=False): return 'MPI_Datatype' +@Type.add_type('DATATYPE_OUT', abi_type=['ompi']) +class TypeDatatypeOut(Type): + + def type_text(self, enable_count=False): + return 'MPI_Datatype *' + @Type.add_type('DATATYPE_ARRAY', abi_type=['ompi']) class TypeDatatypeArray(Type): @@ -369,19 +381,18 @@ class TypeDatatypeStandard(StandardABIType): def init_code(self): return [f'MPI_Datatype {self.tmpname} = {ConvertFuncs.DATATYPE}({self.name});'] - def type_text(self, enable_count=False): - return self.mangle_name('MPI_Datatype') - + def tmp_type_text(self, enable_count=False): + return 'MPI_Datatype' -@Type.add_type('DATATYPE_OUT', abi_type=['ompi']) -class TypeDatatypeOut(Type): + def return_code(self, name): + return [f'return {ConvertOMPIToStandard.DATATYPE}({name});'] def type_text(self, enable_count=False): - return 'MPI_Datatype *' + return self.mangle_name('MPI_Datatype') @Type.add_type('DATATYPE_OUT', abi_type=['standard']) -class TypeDatatypeStandard(Type): +class TypeDatatypeOutStandard(StandardABIType): @property def final_code(self): @@ -395,6 +406,43 @@ def type_text(self, enable_count=False): def argument(self): return f'(MPI_Datatype *) {self.name}' +# +# TODO THIS IS NOT COMPLETE +# +@Type.add_type('DATATYPE_ARRAY', abi_type=['standard']) +class TypeDatatypeArrayStandard(StandardABIType): + + @property + def init_code(self): + if self.count_param is None: + code = [f'MPI_Comm comm_{self.tmpname} = {ConvertFuncs.COMM}(comm);'] + code.append(f'int size_{self.tmpname} = OMPI_COMM_IS_INTER(comm_{self.tmpname})?ompi_comm_remote_size(comm_{self.tmpname}):ompi_comm_size(comm_{self.tmpname});') + else: + code = [f'int size_{self.tmpname} = {self.count_param};'] + code.append(f'MPI_Datatype *{self.tmpname} = (MPI_Datatype *)malloc(sizeof(MPI_Datatype) * size_{self.tmpname});') + code.append(f'for(int i=0;iuser_extra_state = extra_state;') + code.append('helper->user_copy_fn = comm_copy_attr_fn;') + code.append('helper->user_delete_fn = comm_delete_attr_fn;') + return code + + # TODO: This should be generalized to be reused with type and win + @property + def callback_wrapper_code(self): + code = [] + code = ['typedef struct {'] + code.append(' MPI_Comm_copy_attr_function_ABI_INTERNAL *user_copy_fn;') + code.append(' MPI_Comm_delete_attr_function_ABI_INTERNAL *user_delete_fn;') + code.append(' void *user_extra_state;') + code.append('} ompi_abi_wrapper_helper_t;') + code.append('static int ompi_abi_copy_attr_fn(MPI_Comm oldcomm, int comm_keyval, void *extra_state, void *attribute_val_in, void *attribute_val_out, int *flag)') + code.append('{') + code.append(' ompi_abi_wrapper_helper_t *helper = (ompi_abi_wrapper_helper_t *)extra_state;') + code.append(' MPI_Comm_ABI_INTERNAL comm_tmp = ompi_convert_comm_ompi_to_standard(oldcomm);') + code.append(' return helper->user_copy_fn((MPI_Comm_ABI_INTERNAL)comm_tmp, comm_keyval, helper->user_extra_state, attribute_val_in, attribute_val_out, flag);') + code.append('}') + code.append('static int ompi_abi_delete_attr_fn(MPI_Comm oldcomm, int comm_keyval, void *attribute_val, void *extra_state)') + code.append('{') + code.append(' ompi_abi_wrapper_helper_t *helper = (ompi_abi_wrapper_helper_t *)extra_state;') + code.append(' MPI_Comm_ABI_INTERNAL comm_tmp = ompi_convert_comm_ompi_to_standard(oldcomm);') + code.append(' return helper->user_delete_fn((MPI_Comm_ABI_INTERNAL)comm_tmp, comm_keyval, attribute_val, helper->user_extra_state);') + code.append(' free(helper);') + code.append('}') + return code @Type.add_type('COMM_DELETE_ATTR_FUNCTION', abi_type=['ompi']) class TypeCommDeleteAttrFunction(Type): @@ -970,9 +1205,14 @@ def type_text(self, enable_count=False): @Type.add_type('COMM_DELETE_ATTR_FUNCTION', abi_type=['standard']) class TypeCommDeleteAttrFunctionStandard(Type): - # TODO: This may require a special function to wrap the callback - pass + def type_text(self, enable_count=False): + type_name = self.mangle_name('MPI_Comm_delete_attr_function') + return f'{type_name} *' + + @property + def argument(self): + return f'(MPI_Comm_delete_attr_function *) {self.name}' @Type.add_type('GREQUEST_QUERY_FUNCTION', abi_type=['ompi']) class TypeGrequestQueryFunction(Type): @@ -984,8 +1224,10 @@ def type_text(self, enable_count=False): @Type.add_type('GREQUEST_QUERY_FUNCTION', abi_type=['standard']) class TypeGrequestQueryFunctionStandard(Type): # TODO: This may require a special function to wrap the callback - pass +# pass + def type_text(self, enable_count=False): + return 'MPI_Grequest_query_function *' @Type.add_type('GREQUEST_FREE_FUNCTION', abi_type=['ompi']) class TypeGrequestFreeFunction(Type): @@ -997,8 +1239,10 @@ def type_text(self, enable_count=False): @Type.add_type('GREQUEST_FREE_FUNCTION', abi_type=['standard']) class TypeGrequestFreeFunctionStandard(Type): # TODO: This may require a special function to wrap the callback - pass +# pass + def type_text(self, enable_count=False): + return 'MPI_Grequest_free_function *' @Type.add_type('GREQUEST_CANCEL_FUNCTION', abi_type=['ompi']) class TypeGrequestCancelFunction(Type): @@ -1010,8 +1254,10 @@ def type_text(self, enable_count=False): @Type.add_type('GREQUEST_CANCEL_FUNCTION', abi_type=['standard']) class TypeGrequestCancelFunctionStandard(Type): # TODO: This may require a special function to wrap the callback - pass +# pass + def type_text(self, enable_count=False): + return 'MPI_Grequest_cancel_function *' @Type.add_type('DATAREP_CONVERSION_FUNCTION', abi_type=['ompi']) class TypeDatarepConversionFunction(Type): @@ -1026,8 +1272,14 @@ def type_text(self, enable_count=False): @Type.add_type('DATAREP_CONVERSION_FUNCTION', abi_type=['standard']) class TypeDatarepConversionFunctionStandard(Type): # TODO: This may require a special function to wrap the callback - pass +# pass + + @property + def is_count(self): + return True + def type_text(self, enable_count=False): + return 'MPI_Datarep_conversion_function_c *' if enable_count else 'MPI_Datarep_conversion_function *' @Type.add_type('DATAREP_EXTENT_FUNCTION', abi_type=['ompi']) class TypeDatarepExtentFunction(Type): @@ -1039,8 +1291,10 @@ def type_text(self, enable_count=False): @Type.add_type('DATAREP_EXTENT_FUNCTION', abi_type=['standard']) class TypeDatarepExtentFunctionStandard(Type): # TODO: This may require a special function to wrap the callback - pass +# pass + def type_text(self, enable_count=False): + return 'MPI_Datarep_extent_function *' @Type.add_type('SESSION_ERRHANDLER_FUNCTION', abi_type=['ompi']) class TypeSessionErrhandlerFunction(Type): @@ -1052,8 +1306,10 @@ def type_text(self, enable_count=False): @Type.add_type('SESSION_ERRHANDLER_FUNCTION', abi_type=['standard']) class TypeSessionErrhandlerFunctionStandard(Type): # TODO: This may require a special function to wrap the callback - pass +# pass + def type_text(self, enable_count=False): + return 'MPI_Session_errhandler_function *' @Type.add_type('TYPE_COPY_ATTR_FUNCTION', abi_type=['ompi']) class TypeTypeCopyAttrFunction(Type): @@ -1061,12 +1317,51 @@ class TypeTypeCopyAttrFunction(Type): def type_text(self, enable_count=False): return 'MPI_Type_copy_attr_function *' - @Type.add_type('TYPE_COPY_ATTR_FUNCTION', abi_type=['standard']) class TypeTypeCopyAttrFunctionStandard(Type): - # TODO: This may require a special function to wrap the callback - pass + def type_text(self, enable_count=False): + type_name = self.mangle_name('MPI_Type_copy_attr_function') + return f'{type_name} *' + + @property + def argument(self): + return f'(MPI_Type_copy_attr_function *) {self.name}' + + @property + def init_code(self): + code = [] + code = ['ompi_abi_wrapper_helper_t *helper = NULL;'] + code.append('helper = ( ompi_abi_wrapper_helper_t *)malloc(sizeof(ompi_abi_wrapper_helper_t));') + code.append('if (NULL == helper) return MPI_ERR_NO_MEM;') + code.append('helper->user_extra_state = extra_state;') + code.append('helper->user_copy_fn = type_copy_attr_fn;') + code.append('helper->user_delete_fn = type_delete_attr_fn;') + return code + + # TODO: This should be generalized to be reused with type and win + @property + def callback_wrapper_code(self): + code = [] + code = ['typedef struct {'] + code.append(' MPI_Type_copy_attr_function_ABI_INTERNAL *user_copy_fn;') + code.append(' MPI_Type_delete_attr_function_ABI_INTERNAL *user_delete_fn;') + code.append(' void *user_extra_state;') + code.append('} ompi_abi_wrapper_helper_t;') + code.append('static int ompi_abi_copy_attr_fn(MPI_Datatype oldtype, int type_keyval, void *extra_state, void *attribute_val_in, void *attribute_val_out, int *flag)') + code.append('{') + code.append(' ompi_abi_wrapper_helper_t *helper = (ompi_abi_wrapper_helper_t *)extra_state;') + code.append(' MPI_Datatype_ABI_INTERNAL type_tmp = ompi_convert_datatype_ompi_to_standard(oldtype);') + code.append(' return helper->user_copy_fn((MPI_Datatype_ABI_INTERNAL)type_tmp, type_keyval, helper->user_extra_state, attribute_val_in, attribute_val_out, flag);') + code.append('}') + code.append('static int ompi_abi_delete_attr_fn(MPI_Datatype oldtype, int type_keyval, void *attribute_val, void *extra_state)') + code.append('{') + code.append(' ompi_abi_wrapper_helper_t *helper = (ompi_abi_wrapper_helper_t *)extra_state;') + code.append(' MPI_Datatype_ABI_INTERNAL type_tmp = ompi_convert_datatype_ompi_to_standard(oldtype);') + code.append(' return helper->user_delete_fn((MPI_Datatype_ABI_INTERNAL)type_tmp, type_keyval, attribute_val, helper->user_extra_state);') + code.append(' free(helper);') + code.append('}') + return code @Type.add_type('TYPE_DELETE_ATTR_FUNCTION', abi_type=['ompi']) class TypeTypeDeleteAttrFunction(Type): @@ -1077,11 +1372,17 @@ def type_text(self, enable_count=False): @Type.add_type('TYPE_DELETE_ATTR_FUNCTION', abi_type=['standard']) class TypeTypeDeleteAttrFunctionStandard(Type): - # TODO: This may require a special function to wrap the callback - pass + def type_text(self, enable_count=False): + type_name = self.mangle_name('MPI_Type_delete_attr_function') + return f'{type_name} *' + + @property + def argument(self): + return f'(MPI_Type_delete_attr_function *) {self.name}' + +@Type.add_type('WIN_ERRHANDLER_FUNCTION', abi_type=['ompi']) -@Type.add_type('WIN_ERRHANLDER_FUNCTION', abi_type=['ompi']) class TypeWinErrhandlerFunction(Type): def type_text(self, enable_count=False): @@ -1091,8 +1392,10 @@ def type_text(self, enable_count=False): @Type.add_type('WIN_ERRHANDLER_FUNCTION', abi_type=['standard']) class TypeWinErrhandlerFunctionStandard(Type): # TODO: This may require a special function to wrap the callback - pass +# pass + def type_text(self, enable_count=False): + return 'MPI_Win_errhandler_function *' @Type.add_type('WIN_COPY_ATTR_FUNCTION', abi_type=['ompi']) class TypeWinCopyAttrFunction(Type): @@ -1103,8 +1406,48 @@ def type_text(self, enable_count=False): @Type.add_type('WIN_COPY_ATTR_FUNCTION', abi_type=['standard']) class TypeWinCopyAttrFunctionStandard(Type): - # TODO: This may require a special function to wrap the callback - pass + + def type_text(self, enable_count=False): + type_name = self.mangle_name('MPI_Win_copy_attr_function') + return f'{type_name} *' + + @property + def argument(self): + return f'(MPI_Win_copy_attr_function *) {self.name}' + + @property + def init_code(self): + code = [] + code = ['ompi_abi_wrapper_helper_t *helper = NULL;'] + code.append('helper = ( ompi_abi_wrapper_helper_t *)malloc(sizeof(ompi_abi_wrapper_helper_t));') + code.append('if (NULL == helper) return MPI_ERR_NO_MEM;') + code.append('helper->user_extra_state = extra_state;') + code.append('helper->user_copy_fn = win_copy_attr_fn;') + code.append('helper->user_delete_fn = win_delete_attr_fn;') + return code + + @property + def callback_wrapper_code(self): + code = [] + code = ['typedef struct {'] + code.append(' MPI_Win_copy_attr_function_ABI_INTERNAL *user_copy_fn;') + code.append(' MPI_Win_delete_attr_function_ABI_INTERNAL *user_delete_fn;') + code.append(' void *user_extra_state;') + code.append('} ompi_abi_wrapper_helper_t;') + code.append('static int ompi_abi_copy_attr_fn(MPI_Win oldwin, int win_keyval, void *extra_state, void *attribute_val_in, void *attribute_val_out, int *flag)') + code.append('{') + code.append(' ompi_abi_wrapper_helper_t *helper = (ompi_abi_wrapper_helper_t *)extra_state;') + code.append(' MPI_Win_ABI_INTERNAL win_tmp = ompi_convert_win_ompi_to_standard(oldwin);') + code.append(' return helper->user_copy_fn((MPI_Win_ABI_INTERNAL)win_tmp, win_keyval, helper->user_extra_state, attribute_val_in, attribute_val_out, flag);') + code.append('}') + code.append('static int ompi_abi_delete_attr_fn(MPI_Win oldwin, int win_keyval, void *attribute_val, void *extra_state)') + code.append('{') + code.append(' ompi_abi_wrapper_helper_t *helper = (ompi_abi_wrapper_helper_t *)extra_state;') + code.append(' MPI_Win_ABI_INTERNAL win_tmp = ompi_convert_win_ompi_to_standard(oldwin);') + code.append(' return helper->user_delete_fn((MPI_Win_ABI_INTERNAL)win_tmp, win_keyval, attribute_val, helper->user_extra_state);') + code.append(' free(helper);') + code.append('}') + return code @Type.add_type('WIN_DELETE_ATTR_FUNCTION', abi_type=['ompi']) @@ -1116,9 +1459,14 @@ def type_text(self, enable_count=False): @Type.add_type('WIN_DELETE_ATTR_FUNCTION', abi_type=['standard']) class TypeWinDeleteAttrFunctionStandard(Type): - # TODO: This may require a special function to wrap the callback - pass + def type_text(self, enable_count=False): + type_name = self.mangle_name('MPI_Win_delete_attr_function') + return f'{type_name} *' + + @property + def argument(self): + return f'(MPI_Win_delete_attr_function *) {self.name}' @Type.add_type('ERRHANDLER', abi_type=['ompi']) class TypeErrhandler(Type): @@ -1128,15 +1476,20 @@ def type_text(self, enable_count=False): @Type.add_type('ERRHANDLER', abi_type=['standard']) -class TypeErrhandlerStandard(Type): +class TypeErrhandlerStandard(StandardABIType): @property - def argument(self): - return f'(MPI_Errhandler) {self.name}' + def init_code(self): + return [f'MPI_Errhandler {self.tmpname} = {ConvertFuncs.ERRHANDLER}({self.name});'] def type_text(self, enable_count=False): return self.mangle_name('MPI_Errhandler') + def tmp_type_text(self, enable_count=False): + return 'MPI_Errhandler' + + def return_code(self, name): + return [f'return {ConvertOMPIToStandard.ERRHANDLER}({name});'] @Type.add_type('ERRHANDLER_OUT', abi_type=['ompi']) class TypeErrhandlerOut(Type): @@ -1154,7 +1507,7 @@ def argument(self): def type_text(self, enable_count=False): type_name = self.mangle_name('MPI_Errhandler') - return f'{MPI_Errhandler} *' + return f'{type_name} *' @Type.add_type('GROUP', abi_type=['ompi']) @@ -1165,15 +1518,25 @@ def type_text(self, enable_count=False): @Type.add_type('GROUP', abi_type=['standard']) -class TypeGroupStandard(Type): +class TypeGroupStandard(StandardABIType): - @property - def argument(self): - return f'(MPI_Group) {self.name}' +# @property +# def argument(self): +# return f'(MPI_Group) {self.name}' def type_text(self, enable_count=False): return self.mangle_name('MPI_Group') + @property + def init_code(self): + return [f'MPI_Group {self.tmpname} = {ConvertFuncs.GROUP}({self.name});'] + + def tmp_type_text(self, enable_count=False): + return 'MPI_Group' + + def return_code(self, name): + return [f'return {ConvertOMPIToStandard.GROUP}({name});'] + @Type.add_type('GROUP_OUT', abi_type=['ompi']) class TypeGroupOut(Type): @@ -1198,6 +1561,12 @@ def argument(self): return f'(MPI_Group *) {self.name}' +@Type.add_type('SESSION_INOUT', abi_type=['ompi']) +class TypeSessionOut(Type): + + def type_text(self, enable_count=False): + return 'MPI_Session *' + @Type.add_type('SESSION_OUT', abi_type=['ompi']) class TypeSessionOut(Type): @@ -1205,18 +1574,41 @@ def type_text(self, enable_count=False): return 'MPI_Session *' -@Type.add_type('SESSION_OUT', abi_type=['standard']) -class TypeSessionOutStandard(Type): +@Type.add_type('SESSION_INOUT', abi_type=['standard']) +class TypeSessionInOutStandard(StandardABIType): + + @property + def init_code(self): + return [f'MPI_Session {self.tmpname} = {ConvertFuncs.SESSION}(*{self.name});'] + + @property + def final_code(self): + return [f'*{self.name} = {ConvertOMPIToStandard.SESSION}({self.tmpname});'] + + def type_text(self, enable_count=False): + type_name = self.mangle_name('MPI_Session') + return f'{type_name} *' - # TODO: This will require some conversion code for the ABI @property def argument(self): - return f'(MPI_Session *) {self.name}' + return f'&{self.tmpname}' + + +@Type.add_type('SESSION_OUT', abi_type=['standard']) +class TypeSessionOutStandard(StandardABIType): - def type_text(self): + @property + def final_code(self): + return [f'*{self.name} = {ConvertOMPIToStandard.SESSION}((MPI_Session) *{self.name});'] + + def type_text(self, enable_count=False): type_name = self.mangle_name('MPI_Session') return f'{type_name} *' + @property + def argument(self): + return f'(MPI_Session *) {self.name}' + @Type.add_type('SESSION', abi_type=['ompi']) class TypeSession(Type): @@ -1226,12 +1618,23 @@ def type_text(self, enable_count=False): @Type.add_type('SESSION', abi_type=['standard']) -class TypeSessionStandard(Type): +class TypeSessionStandard(StandardABIType): - # TODO: This will require some conversion code for the ABI @property - def argument(self): - return f'(MPI_Session) {self.name}' + def init_code(self): + return [f'MPI_Session {self.tmpname} = {ConvertFuncs.SESSION}({self.name});'] + +# @property +# def argument(self): +# return f'(MPI_Session) {self.name}' def type_text(self, enable_count=False): return self.mangle_name('MPI_Session') + + def tmp_type_text(self, enable_count=False): + return 'MPI_Session' + + def return_code(self, name): + return [f'return {ConvertOMPIToStandard.SESSION}({name});'] + + diff --git a/ompi/mpi/bindings/ompi_bindings/consts.py b/ompi/mpi/bindings/ompi_bindings/consts.py index 48ef249223f..4e9f568f1d9 100644 --- a/ompi/mpi/bindings/ompi_bindings/consts.py +++ b/ompi/mpi/bindings/ompi_bindings/consts.py @@ -159,6 +159,10 @@ 'MPI_COMM_TYPE_HW_GUIDED', ] +RESERVED_GROUPS = [ + 'MPI_GROUP_NULL', +] + RESERVED_WINDOWS = [ 'MPI_WIN_NULL', ] @@ -176,6 +180,23 @@ 'MPI_FILE_NULL', ] +RESERVED_OPS = [ + 'MPI_OP_NULL', +] + +RESERVED_MESSAGES = [ + 'MPI_MESSAGE_NULL', + 'MPI_MESSAGE_NO_PROC', +] + +RESERVED_SESSIONS = [ + 'MPI_SESSION_NULL', +] + +RESERVED_ERRHANDLERS = [ + 'MPI_ERRHANDLER_NULL', +] + IGNORED_STATUS_HANDLES = [ 'MPI_STATUSES_IGNORE', 'MPI_STATUS_IGNORE', @@ -229,15 +250,28 @@ 'MPI_Win', ] +# +# C objects that can have attributes cached on them +# +C_ATTRIBUTE_OBJS = [ + 'MPI_Comm', + 'MPI_Type', + 'MPI_Win', +] + class ConvertFuncs: """Names of conversion functions (between standard ABI and OMPI ABI).""" - ERROR_CLASS = 'ompi_convert_intern_error_abi_error' + ERROR_CLASS = 'ompi_convert_abi_error_intern_error' + ERRHANDLER = 'ompi_convert_abi_errorhandler_intern_errorhandler' COMM = 'ompi_convert_abi_comm_intern_comm' DATATYPE = 'ompi_convert_abi_datatype_intern_datatype' + GROUP = 'ompi_convert_abi_group_intern_group' REQUEST = 'ompi_convert_abi_request_intern_request' - STATUS = 'ompi_convert_intern_status_abi_status' + STATUS = 'ompi_convert_abi_status_intern_status' + MESSAGE = 'ompi_convert_abi_message_intern_message' OP = 'ompi_convert_abi_op_intern_op' + SESSION = 'ompi_convert_abi_session_intern_session' WIN = 'ompi_convert_abi_win_intern_win' INFO = 'ompi_convert_abi_info_intern_info' FILE = 'ompi_convert_abi_file_intern_file' @@ -247,6 +281,18 @@ class ConvertOMPIToStandard: """Generated function for converting from OMPI to standard ABI.""" COMM = 'ompi_convert_comm_ompi_to_standard' + ERROR_CLASS = 'ompi_convert_intern_error_abi_error' + ERRHANDLER = 'ompi_convert_intern_errorhandler_abi_errorhandler' + GROUP = 'ompi_convert_group_ompi_to_standard' + DATATYPE = 'ompi_convert_datatype_ompi_to_standard' + FILE = 'ompi_convert_file_ompi_to_standard' + MESSAGE = 'ompi_convert_message_ompi_to_standard' + OP = 'ompi_convert_op_ompi_to_standard' + SESSION = 'ompi_convert_session_ompi_to_standard' + STATUS = 'ompi_convert_intern_status_abi_status' + WIN = 'ompi_convert_win_ompi_to_standard' + REQUEST = 'ompi_convert_ompi_request_abi_request' + INFO = 'ompi_convert_info_ompi_to_standard' # Inline function attributes diff --git a/ompi/mpi/bindings/ompi_bindings/parser.py b/ompi/mpi/bindings/ompi_bindings/parser.py index b7c6b36eba4..7f3a13e65ec 100644 --- a/ompi/mpi/bindings/ompi_bindings/parser.py +++ b/ompi/mpi/bindings/ompi_bindings/parser.py @@ -6,6 +6,9 @@ # Additional copyrights may follow # # $HEADER$ + +import os + """Source parsing code.""" class Parameter: diff --git a/ompi/mpi/bindings/ompi_bindings/util.py b/ompi/mpi/bindings/ompi_bindings/util.py index 68d03eaa563..37b0ac51c08 100644 --- a/ompi/mpi/bindings/ompi_bindings/util.py +++ b/ompi/mpi/bindings/ompi_bindings/util.py @@ -147,7 +147,6 @@ def abi_internal_name(extname): 'DATAREP_CONVERSION_FUNCTION', ] - def prototype_has_bigcount(prototype): """Should this prototype have a bigcount version?""" return any(param.type_name in BIGCOUNT_TYPE_NAMES for param in prototype.params) @@ -165,3 +164,17 @@ def prototype_has_buffers(prototype): return True else: return False + +USER_CALLBACK_NAMES = [ + 'COMM_COPY_ATTR_FUNCTION', + 'COMM_DELETE_ATTR_FUNCTION', + 'TYPE_COPY_ATTR_FUNCTION', + 'TYPE_DELETE_ATTR_FUNCTION', + 'WIN_COPY_ATTR_FUNCTION', + 'WIN_DELETE_ATTR_FUNCTION', +] + +def prototype_needs_callback_wrappers(prototype): + """Should this prototype need a callback wrappers""" + return any(param.type_name in USER_CALLBACK_NAMES for param in prototype.params) + diff --git a/ompi/mpi/c/Makefile.am b/ompi/mpi/c/Makefile.am index c8fad462772..7d396f098c5 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -293,8 +293,6 @@ prototype_sources = \ isendrecv_replace.c.in \ issend.c.in \ is_thread_main.c.in \ - keyval_create.c.in \ - keyval_free.c.in \ lookup_name.c.in \ message_c2f.c.in \ message_f2c.c.in \ @@ -457,6 +455,7 @@ prototype_sources = \ win_flush_local.c.in \ win_free.c.in \ win_free_keyval.c.in \ + win_f2c.c.in \ win_get_attr.c.in \ win_get_errhandler.c.in \ win_get_group.c.in \ @@ -478,53 +477,64 @@ prototype_sources = \ win_wait.c.in \ wtime.c.in -# Include template files in case someone wants to update them EXTRA_DIST = $(prototype_sources) # attr_fn.c contains attribute manipulation functions which do not # profiling implications, and so are always built. libmpi_c_la_SOURCES = \ attr_fn.c + +# The MPI_Abi_* functions do not require profiling implementations. +libmpi_c_la_SOURCES += \ + abi_details.c \ + abi_supported.c \ + abi_version.c \ + ompi_isendrecv.c \ + ompi_sendrecv.c + libmpi_c_la_LIBADD = libmpi_c_profile.la if BUILD_MPI_BINDINGS_LAYER libmpi_c_la_LIBADD += libmpi_c_noprofile.la endif -# Conditionally install the header files -if WANT_INSTALL_HEADERS -ompidir = $(ompiincludedir)/$(subdir) -ompi_HEADERS = $(headers) -endif +nobase_include_HEADERS = abi.h standard_abi/mpi.h # -# List of all C files that have profile versions (generated_*.c files were +# List of all C files that have profile versions (*_generated.c files were # generated from prototype_sources above). # # -interface_profile_sources = $(prototype_sources:.c.in=_generated.c) +interface_profile_sources = $(prototype_sources:.c.in=_ompi_generated.c) + +# Conditionally install the header files +if WANT_INSTALL_HEADERS +ompidir = $(ompiincludedir)/$(subdir) +ompi_HEADERS = $(headers) +endif # The following are special case functions where we # have to deal manually # -interface_profile_sources += \ +extra_interface_profile_sources = \ pcontrol.c \ type_get_contents.c \ type_get_contents_c.c \ type_get_envelope.c \ type_get_envelope_c.c \ - win_f2c.c \ wtick.c # The following functions were removed from the MPI standard, but are # retained for ABI compliance reasons. They are listed independently # of the other MPI functions in case we one day change behavior around # ABI compliance. -interface_profile_sources += \ +deprecated_interface_profile_sources = \ address.c \ errhandler_create.c \ errhandler_get.c \ errhandler_set.c \ + keyval_create.c \ + keyval_free.c \ type_extent.c \ type_hindexed.c \ type_hvector.c \ @@ -532,14 +542,14 @@ interface_profile_sources += \ type_struct.c \ type_ub.c -libmpi_c_profile_la_SOURCES = $(interface_profile_sources) +libmpi_c_profile_la_SOURCES = $(interface_profile_sources) $(extra_interface_profile_sources) $(deprecated_interface_profile_sources) libmpi_c_profile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=1 -libmpi_c_noprofile_la_SOURCES = $(interface_profile_sources) +libmpi_c_noprofile_la_SOURCES = $(interface_profile_sources) $(extra_interface_profile_sources) $(deprecated_interface_profile_sources) libmpi_c_noprofile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=0 -# ABI generation rules -%_generated.c: %.c.in +if OMPI_GENERATE_BINDINGS +%_ompi_generated.c: %.c.in $(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/bindings.py \ --builddir $(abs_top_builddir) \ --srcdir $(abs_top_srcdir) \ @@ -548,6 +558,38 @@ libmpi_c_noprofile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=0 source \ ompi \ $< +abi.h: $(prototype_sources) + $(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/bindings.py \ + --builddir $(abs_top_builddir) \ + --srcdir $(abs_top_srcdir) \ + --output $@ \ + c \ + header \ + --srcdir $(srcdir) \ + $(prototype_sources) +standard_abi/mpi.h: $(prototype_sources) + mkdir -p standard_abi + $(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/bindings.py \ + --builddir $(abs_top_builddir) \ + --srcdir $(abs_top_srcdir) \ + --output $@ \ + c \ + header \ + --srcdir $(srcdir) \ + --external \ + $(prototype_sources) +%_abi_generated.c: %.c.in + $(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/bindings.py \ + --builddir $(abs_top_builddir) \ + --srcdir $(abs_top_srcdir) \ + --output $@ \ + c \ + source \ + standard \ + $< +endif -# Delete generated files on maintainer-clean -MAINTAINERCLEANFILES = *_generated.c +MAINTAINERCLEANFILES = *_generated.c abi.h +if OMPI_STANDARD_ABI +include Makefile_abi.include +endif diff --git a/ompi/mpi/c/Makefile_abi.include b/ompi/mpi/c/Makefile_abi.include new file mode 100644 index 00000000000..c082b84e1c0 --- /dev/null +++ b/ompi/mpi/c/Makefile_abi.include @@ -0,0 +1,61 @@ +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2013 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) 2009-2021 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011 Sandia National Laboratories. All rights reserved. +# Copyright (c) 2012 Oak Rigde National Laboratory. All rights reserved. +# Copyright (c) 2012-2013 Inria. All rights reserved. +# Copyright (c) 2013-2018 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) 2021 Amazon.com, Inc. or its affiliates. All Rights +# reserved. +# Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# ABI specific make components + +if OMPI_STANDARD_ABI + +noinst_LTLIBRARIES += libmpi_c_abi.la libmpi_c_abi_profile.la +if BUILD_MPI_BINDINGS_LAYER +noinst_LTLIBRARIES += libmpi_c_abi_noprofile.la +endif + +BUILT_SOURCES = abi.h standard_abi/mpi.h + +libmpi_c_abi_la_SOURCES = \ + attr_fn.c \ + abi_details.c \ + abi_supported.c \ + abi_version.c + +libmpi_c_abi_la_CPPFLAGS = -DOMPI_NO_MPI_PROTOTYPES +libmpi_c_abi_la_LIBADD = libmpi_c_abi_profile.la +if BUILD_MPI_BINDINGS_LAYER +libmpi_c_abi_la_LIBADD += libmpi_c_abi_noprofile.la +endif + +abi_interface_profile_sources = $(prototype_sources:.c.in=_abi_generated.c) + +libmpi_c_abi_profile_la_SOURCES = $(abi_interface_profile_sources) +libmpi_c_abi_profile_la_CPPFLAGS = -DOMPI_NO_MPI_PROTOTYPES -DOMPI_BUILD_MPI_PROFILING=1 + +libmpi_c_abi_noprofile_la_SOURCES = $(abi_interface_profile_sources) +libmpi_c_abi_noprofile_la_CPPFLAGS = -DOMPI_NO_MPI_PROTOTYPES -DOMPI_BUILD_MPI_PROFILING=0 + +endif diff --git a/ompi/mpi/c/abi_details.c b/ompi/mpi/c/abi_details.c new file mode 100644 index 00000000000..8dfc7b6e629 --- /dev/null +++ b/ompi/mpi/c/abi_details.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Triad National Security, LLC. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include + +#include "opal/util/show_help.h" +#include "ompi/runtime/ompi_spc.h" +#include "ompi/mpi/c/bindings.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/constants.h" +#ifdef OMPI_NO_MPI_PROTOTYPES +#include "ompi/mpi/c/abi.h" +#endif + +static const char ABI_DETAILS[] = "Open MPI Standard ABI 0.1"; + +int MPI_Abi_details(int *buflen, char *details, MPI_Info *info) +{ + if (*buflen >= (int) sizeof(ABI_DETAILS)) { + strcpy(details, ABI_DETAILS); + *buflen = sizeof(ABI_DETAILS); + return MPI_SUCCESS; + } else { + *buflen = 0; + return MPI_ERR_BUFFER; + } +} diff --git a/ompi/mpi/c/abi_supported.c b/ompi/mpi/c/abi_supported.c new file mode 100644 index 00000000000..b8b977962ba --- /dev/null +++ b/ompi/mpi/c/abi_supported.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Triad National Security, LLC. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include + +#include "opal/util/show_help.h" +#include "ompi/runtime/ompi_spc.h" +#include "ompi/mpi/c/bindings.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/constants.h" +#ifdef OMPI_NO_MPI_PROTOTYPES +#include "ompi/mpi/c/abi.h" +#endif + +int MPI_Abi_supported(int *flag) +{ + *flag = 1; + return MPI_SUCCESS; +} diff --git a/ompi/mpi/c/abi_version.c b/ompi/mpi/c/abi_version.c new file mode 100644 index 00000000000..33d32854893 --- /dev/null +++ b/ompi/mpi/c/abi_version.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 Triad National Security, LLC. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include + +#include "opal/util/show_help.h" +#include "ompi/runtime/ompi_spc.h" +#include "ompi/mpi/c/bindings.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/constants.h" +#ifdef OMPI_NO_MPI_PROTOTYPES +#include "ompi/mpi/c/abi.h" +#endif + +int MPI_Abi_version(int *abi_major, int *abi_minor) +{ + /* 0.1 */ + *abi_major = 0; + *abi_minor = 1; + return MPI_SUCCESS; +} diff --git a/ompi/mpi/c/bindings.h b/ompi/mpi/c/bindings.h index 2a849feea8d..717fe79287f 100644 --- a/ompi/mpi/c/bindings.h +++ b/ompi/mpi/c/bindings.h @@ -116,6 +116,11 @@ BEGIN_C_DECLS } while (0) +int ompi_sendrecv(const void * sendbuf, size_t sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void * recvbuf, size_t recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status); +int ompi_isendrecv(const void * sendbuf, size_t sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void * recvbuf, size_t recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Request * request); + END_C_DECLS #endif /* OMPI_C_BINDINGS_H */ diff --git a/ompi/mpi/c/comm_create_keyval.c.in b/ompi/mpi/c/comm_create_keyval.c.in index d69c245fc49..e8352be3773 100644 --- a/ompi/mpi/c/comm_create_keyval.c.in +++ b/ompi/mpi/c/comm_create_keyval.c.in @@ -36,6 +36,7 @@ PROTOTYPE ERROR_CLASS comm_create_keyval(COMM_COPY_ATTR_FUNCTION comm_copy_attr_ INT_OUT comm_keyval, BUFFER_OUT extra_state) { int ret; + int flags = 0; ompi_attribute_fn_ptr_union_t copy_fn; ompi_attribute_fn_ptr_union_t del_fn; @@ -48,11 +49,16 @@ PROTOTYPE ERROR_CLASS comm_create_keyval(COMM_COPY_ATTR_FUNCTION comm_copy_attr_ } } +#if OMPI_ABI_SRC + copy_fn.attr_communicator_copy_fn = ompi_abi_copy_attr_fn; + del_fn.attr_communicator_delete_fn = ompi_abi_delete_attr_fn; +#else copy_fn.attr_communicator_copy_fn = comm_copy_attr_fn; del_fn.attr_communicator_delete_fn = comm_delete_attr_fn; +#endif - ret = ompi_attr_create_keyval(COMM_ATTR, copy_fn, - del_fn, comm_keyval, extra_state, 0, NULL); + ret = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn, + comm_keyval, extra_state, flags, NULL); OMPI_ERRHANDLER_NOHANDLE_RETURN(ret, MPI_ERR_OTHER, FUNC_NAME); } diff --git a/ompi/mpi/c/comm_spawn_multiple.c.in b/ompi/mpi/c/comm_spawn_multiple.c.in index a729df6dfd0..72b43a2dbc3 100644 --- a/ompi/mpi/c/comm_spawn_multiple.c.in +++ b/ompi/mpi/c/comm_spawn_multiple.c.in @@ -42,7 +42,7 @@ #include "ompi/memchecker.h" PROTOTYPE ERROR_CLASS comm_spawn_multiple(INT count, STRING_ARRAY array_of_commands, ARGV array_of_argv, - INT_ARRAY array_of_maxprocs, INFO_ARRAY array_of_info, + INT_ARRAY array_of_maxprocs, INFO_ARRAY array_of_info:count, INT root, COMM comm, COMM_OUT intercomm, INT_OUT array_of_errcodes) { diff --git a/ompi/mpi/c/file_close.c.in b/ompi/mpi/c/file_close.c.in index 4111c6a3026..19b844be21a 100644 --- a/ompi/mpi/c/file_close.c.in +++ b/ompi/mpi/c/file_close.c.in @@ -27,7 +27,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -PROTOTYPE ERROR_CLASS file_close(FILE_OUT fh) +PROTOTYPE ERROR_CLASS file_close(FILE_INOUT fh) { int rc; diff --git a/ompi/mpi/c/isendrecv.c.in b/ompi/mpi/c/isendrecv.c.in index 39f410b6796..8bd8a75afa6 100644 --- a/ompi/mpi/c/isendrecv.c.in +++ b/ompi/mpi/c/isendrecv.c.in @@ -37,60 +37,12 @@ #include "ompi/runtime/ompi_spc.h" -struct ompi_isendrecv_context_t { - opal_object_t super; - int nreqs; - int source; - ompi_request_t *subreq[2]; -}; - -typedef struct ompi_isendrecv_context_t ompi_isendrecv_context_t; -#if OMPI_BUILD_MPI_PROFILING -OBJ_CLASS_INSTANCE(ompi_isendrecv_context_t, opal_object_t, NULL, NULL); -#else -OBJ_CLASS_DECLARATION(ompi_isendrecv_context_t); -#endif /* OMPI_BUILD_MPI_PROFILING */ - -static int ompi_isendrecv_complete_func (ompi_comm_request_t *request) -{ - ompi_isendrecv_context_t *context = - (ompi_isendrecv_context_t *) request->context; - - /* - * Copy the status from the receive side of the sendrecv request? - * But what if the send failed? - * - * Probably need to bring up in the MPI forum. - */ - - if (MPI_PROC_NULL != context->source) { - OMPI_COPY_STATUS(&request->super.req_status, - context->subreq[0]->req_status, false); - } else { - OMPI_COPY_STATUS(&request->super.req_status, - ompi_request_empty.req_status, false); - } - - if(NULL != context->subreq[0]) { - ompi_request_free(&context->subreq[0]); - } - if(NULL != context->subreq[1]) { - ompi_request_free(&context->subreq[1]); - } - - return OMPI_SUCCESS; -} - PROTOTYPE ERROR_CLASS isendrecv(BUFFER sendbuf, COUNT sendcount, DATATYPE sendtype, INT dest, INT sendtag, BUFFER_OUT recvbuf, COUNT recvcount, DATATYPE recvtype, INT source, INT recvtag, COMM comm, REQUEST_INOUT request) { - ompi_isendrecv_context_t *context = NULL; - ompi_comm_request_t *crequest; int rc = MPI_SUCCESS; - int nreqs = 0; - uint32_t flags; SPC_RECORD(OMPI_SPC_ISENDRECV, 1); @@ -125,64 +77,9 @@ PROTOTYPE ERROR_CLASS isendrecv(BUFFER sendbuf, COUNT sendcount, DATATYPE sendty OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } - crequest = ompi_comm_request_get (); - if (NULL == crequest) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - - context = OBJ_NEW(ompi_isendrecv_context_t); - if (NULL == context) { - ompi_comm_request_return (crequest); - return OMPI_ERR_OUT_OF_RESOURCE; - } - - crequest->context = &context->super; - context->subreq[0] = MPI_REQUEST_NULL; - context->subreq[1] = MPI_REQUEST_NULL; - context->source = source; - - if (source != MPI_PROC_NULL) { /* post recv */ - rc = MCA_PML_CALL(irecv(recvbuf, recvcount, recvtype, - source, recvtag, comm, &context->subreq[nreqs++])); - if (MPI_SUCCESS != rc) { - OBJ_RELEASE(context); - ompi_comm_request_return (crequest); - } - OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); - } - - if (dest != MPI_PROC_NULL) { /* send */ - rc = MCA_PML_CALL(isend(sendbuf, sendcount, sendtype, dest, - sendtag, MCA_PML_BASE_SEND_STANDARD, comm, &context->subreq[nreqs++])); - if (MPI_SUCCESS != rc) { - OBJ_RELEASE(context); - ompi_comm_request_return (crequest); - } - OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); - } - - /* - * schedule the operation - */ - - context->nreqs = nreqs; - assert(nreqs <= 2); - - flags = OMPI_COMM_REQ_FLAG_RETAIN_SUBREQ; - - rc = ompi_comm_request_schedule_append_w_flags(crequest, ompi_isendrecv_complete_func, - context->subreq, nreqs, flags); - if (MPI_SUCCESS != rc) { - OBJ_RELEASE(context); - ompi_comm_request_return (crequest); - } + rc = ompi_isendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, request); OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); - /* kick off the request */ - - ompi_comm_request_start (crequest); - *request = &crequest->super; - return rc; } diff --git a/ompi/mpi/c/isendrecv_replace.c.in b/ompi/mpi/c/isendrecv_replace.c.in index 2dad8a3078e..34077e25603 100644 --- a/ompi/mpi/c/isendrecv_replace.c.in +++ b/ompi/mpi/c/isendrecv_replace.c.in @@ -34,6 +34,10 @@ #include "ompi/proc/proc.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" +#include "opal/mca/mpool/mpool.h" +#ifdef OMPI_NO_MPI_PROTOTYPES +#include "ompi/mpi/c/abi.h" +#endif struct ompi_isendrecv_replace_context_t { opal_object_t super; @@ -58,7 +62,7 @@ static void ompi_isendrecv_context_constructor(ompi_isendrecv_replace_context_t static void ompi_isendrecv_context_destructor(ompi_isendrecv_replace_context_t *context) { if (context->packed_size > sizeof(context->packed_data)) { - PMPI_Free_mem(context->iov.iov_base); + mca_mpool_base_free(context->iov.iov_base); } OBJ_DESTRUCT(&context->convertor); } @@ -144,7 +148,7 @@ PROTOTYPE ERROR_CLASS isendrecv_replace(BUFFER_OUT buf, COUNT count, DATATYPE da /* simple case */ if ( source == MPI_PROC_NULL || dest == MPI_PROC_NULL || count == 0 ) { - rc = PMPI_Isendrecv(buf, count, datatype, dest, sendtag, buf, count, datatype, source, recvtag, comm, request); + rc = ompi_isendrecv(buf, count, datatype, dest, sendtag, buf, count, datatype, source, recvtag, comm, request); return rc; } @@ -181,8 +185,8 @@ PROTOTYPE ERROR_CLASS isendrecv_replace(BUFFER_OUT buf, COUNT count, DATATYPE da /* setup a buffer for recv */ opal_convertor_get_packed_size( &context->convertor, &context->packed_size ); if( context->packed_size > sizeof(context->packed_data) ) { - rc = PMPI_Alloc_mem(context->packed_size, MPI_INFO_NULL, &context->iov.iov_base); - if(OMPI_SUCCESS != rc) { + context->iov.iov_base = (void *)mca_mpool_base_alloc ((size_t)context->packed_size, NULL, NULL); + if(NULL == context->iov.iov_base) { OBJ_RELEASE(context); ompi_comm_request_return (crequest); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); diff --git a/ompi/mpi/c/keyval_create.c.in b/ompi/mpi/c/keyval_create.c similarity index 76% rename from ompi/mpi/c/keyval_create.c.in rename to ompi/mpi/c/keyval_create.c index 8a318ad4da3..d802c257dc9 100644 --- a/ompi/mpi/c/keyval_create.c.in +++ b/ompi/mpi/c/keyval_create.c @@ -1,3 +1,4 @@ +/* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND. */ /* * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology @@ -31,22 +32,26 @@ #include "ompi/attribute/attribute.h" #include "ompi/communicator/communicator.h" -PROTOTYPE ERROR_CLASS keyval_create(COPY_FUNCTION copy_attr_fn, - DELETE_FUNCTION delete_attr_fn, - INT_OUT keyval, BUFFER_OUT extra_state) +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Keyval_create = PMPI_Keyval_create +#endif +#define MPI_Keyval_create PMPI_Keyval_create +#endif +int MPI_Keyval_create(MPI_Copy_function * copy_attr_fn, MPI_Delete_function * delete_attr_fn, int *keyval, void * extra_state) { int ret; ompi_attribute_fn_ptr_union_t copy_fn; ompi_attribute_fn_ptr_union_t del_fn; if (MPI_PARAM_CHECK) { - OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + OMPI_ERR_INIT_FINALIZE("MPI_Keyval_create"); if (NULL == keyval) { return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_KEYVAL, - FUNC_NAME); + "MPI_Keyval_create"); } else if ((NULL == copy_attr_fn) || (NULL == delete_attr_fn)) { return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_ARG, - FUNC_NAME); + "MPI_Keyval_create"); } } @@ -55,5 +60,5 @@ PROTOTYPE ERROR_CLASS keyval_create(COPY_FUNCTION copy_attr_fn, ret = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn, keyval, extra_state, 0, NULL); - OMPI_ERRHANDLER_NOHANDLE_RETURN(ret, MPI_ERR_OTHER, FUNC_NAME); + OMPI_ERRHANDLER_NOHANDLE_RETURN(ret, MPI_ERR_OTHER, "MPI_Keyval_create"); } diff --git a/ompi/mpi/c/keyval_free.c.in b/ompi/mpi/c/keyval_free.c similarity index 78% rename from ompi/mpi/c/keyval_free.c.in rename to ompi/mpi/c/keyval_free.c index 8705ada7a10..6b6ffa06b8a 100644 --- a/ompi/mpi/c/keyval_free.c.in +++ b/ompi/mpi/c/keyval_free.c @@ -1,3 +1,4 @@ +/* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND. */ /* * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology @@ -28,7 +29,13 @@ #include "ompi/attribute/attribute.h" #include "ompi/communicator/communicator.h" -PROTOTYPE ERROR_CLASS keyval_free(INT_OUT keyval) +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Keyval_free = PMPI_Keyval_free +#endif +#define MPI_Keyval_free PMPI_Keyval_free +#endif +int MPI_Keyval_free(int *keyval) { int ret; @@ -36,10 +43,10 @@ PROTOTYPE ERROR_CLASS keyval_free(INT_OUT keyval) if (MPI_PARAM_CHECK) { if (NULL == keyval) { return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_KEYVAL, - FUNC_NAME); + "MPI_Keyval_free"); } } ret = ompi_attr_free_keyval(COMM_ATTR, keyval, 0); - OMPI_ERRHANDLER_NOHANDLE_RETURN(ret, MPI_ERR_OTHER, FUNC_NAME); + OMPI_ERRHANDLER_NOHANDLE_RETURN(ret, MPI_ERR_OTHER, "MPI_Keyval_free"); } diff --git a/ompi/mpi/c/ompi_isendrecv.c b/ompi/mpi/c/ompi_isendrecv.c new file mode 100644 index 00000000000..13ce4ef631c --- /dev/null +++ b/ompi/mpi/c/ompi_isendrecv.c @@ -0,0 +1,147 @@ +/* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND. */ +/* -*- 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-2022 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 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2024 Triad National Security, LLC. 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/communicator/comm_request.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mca/pml/pml.h" +#include "ompi/request/request.h" +#include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" + + +struct ompi_isendrecv_context_t { + opal_object_t super; + int nreqs; + int source; + ompi_request_t *subreq[2]; +}; + +typedef struct ompi_isendrecv_context_t ompi_isendrecv_context_t; +OBJ_CLASS_INSTANCE(ompi_isendrecv_context_t, opal_object_t, NULL, NULL); + +static int ompi_isendrecv_complete_func (ompi_comm_request_t *request) +{ + ompi_isendrecv_context_t *context = + (ompi_isendrecv_context_t *) request->context; + + /* + * Copy the status from the receive side of the sendrecv request? + * But what if the send failed? + * + * Probably need to bring up in the MPI forum. + */ + + if (MPI_PROC_NULL != context->source) { + OMPI_COPY_STATUS(&request->super.req_status, + context->subreq[0]->req_status, false); + } else { + OMPI_COPY_STATUS(&request->super.req_status, + ompi_request_empty.req_status, false); + } + + if(NULL != context->subreq[0]) { + ompi_request_free(&context->subreq[0]); + } + if(NULL != context->subreq[1]) { + ompi_request_free(&context->subreq[1]); + } + + return OMPI_SUCCESS; +} + +int ompi_isendrecv(const void * sendbuf, size_t sendcount, MPI_Datatype sendtype, int dest, int sendtag, void * recvbuf, size_t recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Request * request) +{ + ompi_isendrecv_context_t *context = NULL; + ompi_comm_request_t *crequest; + int rc = MPI_SUCCESS; + int nreqs = 0; + uint32_t flags; + + crequest = ompi_comm_request_get (); + if (NULL == crequest) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + + context = OBJ_NEW(ompi_isendrecv_context_t); + if (NULL == context) { + ompi_comm_request_return (crequest); + return OMPI_ERR_OUT_OF_RESOURCE; + } + + crequest->context = &context->super; + context->subreq[0] = MPI_REQUEST_NULL; + context->subreq[1] = MPI_REQUEST_NULL; + context->source = source; + + if (source != MPI_PROC_NULL) { /* post recv */ + rc = MCA_PML_CALL(irecv(recvbuf, recvcount, recvtype, + source, recvtag, comm, &context->subreq[nreqs++])); + if (MPI_SUCCESS != rc) { + OBJ_RELEASE(context); + ompi_comm_request_return (crequest); + } + OMPI_ERRHANDLER_CHECK(rc, comm, rc, "MPI_Isendrecv"); + } + + if (dest != MPI_PROC_NULL) { /* send */ + rc = MCA_PML_CALL(isend(sendbuf, sendcount, sendtype, dest, + sendtag, MCA_PML_BASE_SEND_STANDARD, comm, &context->subreq[nreqs++])); + if (MPI_SUCCESS != rc) { + OBJ_RELEASE(context); + ompi_comm_request_return (crequest); + } + OMPI_ERRHANDLER_CHECK(rc, comm, rc, "MPI_Isendrecv"); + } + + /* + * schedule the operation + */ + + context->nreqs = nreqs; + assert(nreqs <= 2); + + flags = OMPI_COMM_REQ_FLAG_RETAIN_SUBREQ; + + rc = ompi_comm_request_schedule_append_w_flags(crequest, ompi_isendrecv_complete_func, + context->subreq, nreqs, flags); + if (MPI_SUCCESS != rc) { + OBJ_RELEASE(context); + ompi_comm_request_return (crequest); + } + + /* kick off the request */ + + ompi_comm_request_start (crequest); + *request = &crequest->super; + + return rc; +} diff --git a/ompi/mpi/c/ompi_sendrecv.c b/ompi/mpi/c/ompi_sendrecv.c new file mode 100644 index 00000000000..0bcdc5ecce3 --- /dev/null +++ b/ompi/mpi/c/ompi_sendrecv.c @@ -0,0 +1,97 @@ +/* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND. */ +/* -*- 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-2021 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 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved. + * Copyright (c) 2024 Triad National Security, LLC. 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/mca/pml/pml.h" +#include "ompi/request/request.h" +#include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" + +int ompi_sendrecv(const void * sendbuf, size_t sendcount, MPI_Datatype sendtype, int dest, int sendtag, void * recvbuf, size_t recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status) +{ + ompi_request_t* req = MPI_REQUEST_NULL; + int rc = MPI_SUCCESS; + int rcs = MPI_SUCCESS; + + if (source != MPI_PROC_NULL) { /* post recv */ + rc = MCA_PML_CALL(irecv(recvbuf, recvcount, recvtype, + source, recvtag, comm, &req)); + OMPI_ERRHANDLER_CHECK(rc, comm, rc, "MPI_Sendrecv"); + } + + if (dest != MPI_PROC_NULL) { /* send */ + rc = MCA_PML_CALL(send(sendbuf, sendcount, sendtype, dest, + sendtag, MCA_PML_BASE_SEND_STANDARD, comm)); + if (OPAL_UNLIKELY(MPI_SUCCESS != rc)) { + rcs = rc; +#if OPAL_ENABLE_FT_MPI + /* If this is a PROC_FAILED error, we still need to proceed with + * the receive, so that we do not propagate errors to the sender in + * the case src != dst, and only dst is dead. In this case the + * recv is guaranteed to complete (either in error if the source is + * dead, or successfully if the source is live). */ + if (OPAL_UNLIKELY(MPI_ERR_PROC_FAILED != rc)) + /* if intentionally spills outside ifdef */ +#endif + ompi_request_cancel(req); + } + } + + if (source != MPI_PROC_NULL) { /* wait for recv */ + rc = ompi_request_wait(&req, status); +#if OPAL_ENABLE_FT_MPI + /* Sendrecv never returns ERR_PROC_FAILED_PENDING because it is + * blocking. Lets cancel that irecv to complete it NOW and promote + * the error to ERR_PROC_FAILED */ + if( OPAL_UNLIKELY(MPI_ERR_PROC_FAILED_PENDING == rc) ) { + ompi_request_cancel(req); + ompi_request_wait(&req, MPI_STATUS_IGNORE); + rc = MPI_ERR_PROC_FAILED; + } +#endif + } else { + if (MPI_STATUS_IGNORE != status) { + OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false); + /* + * Per MPI-1, the MPI_ERROR field is not defined for single-completion calls + */ + MEMCHECKER( + opal_memchecker_base_mem_undefined(&status->MPI_ERROR, sizeof(int)); + ); + } + rc = MPI_SUCCESS; + } + if( OPAL_UNLIKELY(MPI_SUCCESS != rcs && MPI_SUCCESS == rc) ) { + rc = rcs; + } +} diff --git a/ompi/mpi/c/sendrecv.c.in b/ompi/mpi/c/sendrecv.c.in index d6a30102a50..25167d2d857 100644 --- a/ompi/mpi/c/sendrecv.c.in +++ b/ompi/mpi/c/sendrecv.c.in @@ -41,9 +41,7 @@ PROTOTYPE ERROR_CLASS sendrecv(BUFFER sendbuf, COUNT sendcount, DATATYPE sendtyp DATATYPE recvtype, INT source, INT recvtag, COMM comm, STATUS_OUT status) { - ompi_request_t* req = MPI_REQUEST_NULL; int rc = MPI_SUCCESS; - int rcs = MPI_SUCCESS; SPC_RECORD(OMPI_SPC_SENDRECV, 1); @@ -75,57 +73,9 @@ PROTOTYPE ERROR_CLASS sendrecv(BUFFER sendbuf, COUNT sendcount, DATATYPE sendtyp OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } - if (source != MPI_PROC_NULL) { /* post recv */ - rc = MCA_PML_CALL(irecv(recvbuf, recvcount, recvtype, - source, recvtag, comm, &req)); - OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); - } - - if (dest != MPI_PROC_NULL) { /* send */ - rc = MCA_PML_CALL(send(sendbuf, sendcount, sendtype, dest, - sendtag, MCA_PML_BASE_SEND_STANDARD, comm)); - if (OPAL_UNLIKELY(MPI_SUCCESS != rc)) { - rcs = rc; -#if OPAL_ENABLE_FT_MPI - /* If this is a PROC_FAILED error, we still need to proceed with - * the receive, so that we do not propagate errors to the sender in - * the case src != dst, and only dst is dead. In this case the - * recv is guaranteed to complete (either in error if the source is - * dead, or successfully if the source is live). */ - if (OPAL_UNLIKELY(MPI_ERR_PROC_FAILED != rc)) - /* if intentionally spills outside ifdef */ -#endif - ompi_request_cancel(req); - } - } + rc = ompi_sendrecv(sendbuf, sendcount, sendtype, dest, sendtag, + recvbuf, recvcount, recvtype, source, recvtag, comm, status); - if (source != MPI_PROC_NULL) { /* wait for recv */ - rc = ompi_request_wait(&req, status); -#if OPAL_ENABLE_FT_MPI - /* Sendrecv never returns ERR_PROC_FAILED_PENDING because it is - * blocking. Lets cancel that irecv to complete it NOW and promote - * the error to ERR_PROC_FAILED */ - if( OPAL_UNLIKELY(MPI_ERR_PROC_FAILED_PENDING == rc) ) { - ompi_request_cancel(req); - ompi_request_wait(&req, MPI_STATUS_IGNORE); - rc = MPI_ERR_PROC_FAILED; - } -#endif - } else { - if (MPI_STATUS_IGNORE != status) { - OMPI_COPY_STATUS(status, ompi_request_empty.req_status, false); - /* - * Per MPI-1, the MPI_ERROR field is not defined for single-completion calls - */ - MEMCHECKER( - opal_memchecker_base_mem_undefined(&status->MPI_ERROR, sizeof(int)); - ); - } - rc = MPI_SUCCESS; - } - if( OPAL_UNLIKELY(MPI_SUCCESS != rcs && MPI_SUCCESS == rc) ) { - rc = rcs; - } OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/sendrecv_replace.c.in b/ompi/mpi/c/sendrecv_replace.c.in index 76aadb3ab30..7c8dba56a17 100644 --- a/ompi/mpi/c/sendrecv_replace.c.in +++ b/ompi/mpi/c/sendrecv_replace.c.in @@ -29,6 +29,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "opal/datatype/opal_convertor.h" +#include "opal/mca/mpool/mpool.h" #include "ompi/mca/pml/pml.h" #include "ompi/proc/proc.h" #include "ompi/memchecker.h" @@ -80,7 +81,7 @@ PROTOTYPE ERROR_CLASS sendrecv_replace(BUFFER_OUT buf, COUNT count, DATATYPE dat /* simple case */ if ( source == MPI_PROC_NULL || dest == MPI_PROC_NULL || count == 0 ) { - rc = PMPI_Sendrecv(buf, count, datatype, dest, sendtag, buf, count, datatype, source, recvtag, comm, status); + rc = ompi_sendrecv(buf, count, datatype, dest, sendtag, buf, count, datatype, source, recvtag, comm, status); return rc; } @@ -113,8 +114,8 @@ PROTOTYPE ERROR_CLASS sendrecv_replace(BUFFER_OUT buf, COUNT count, DATATYPE dat /* setup a temporary buffer to send */ opal_convertor_get_packed_size( &convertor, &packed_size ); if( packed_size > sizeof(packed_data) ) { - rc = PMPI_Alloc_mem(packed_size, MPI_INFO_NULL, &iov.iov_base); - if(OMPI_SUCCESS != rc) { + iov.iov_base = (void *)mca_mpool_base_alloc (packed_size, NULL, NULL); + if(NULL == iov.iov_base) { rc = OMPI_ERR_OUT_OF_RESOURCE; goto cleanup_and_return; } @@ -166,7 +167,7 @@ PROTOTYPE ERROR_CLASS sendrecv_replace(BUFFER_OUT buf, COUNT count, DATATYPE dat /* release resources */ if(packed_size > sizeof(packed_data)) { - PMPI_Free_mem(iov.iov_base); + mca_mpool_base_free(iov.iov_base); } OBJ_DESTRUCT(&convertor); diff --git a/ompi/mpi/c/session_finalize.c.in b/ompi/mpi/c/session_finalize.c.in index 44e67abeb8e..90075d5a4c1 100644 --- a/ompi/mpi/c/session_finalize.c.in +++ b/ompi/mpi/c/session_finalize.c.in @@ -17,7 +17,7 @@ #include "ompi/memchecker.h" -PROTOTYPE ERROR_CLASS session_finalize (SESSION_OUT session) +PROTOTYPE ERROR_CLASS session_finalize (SESSION_INOUT session) { int rc; diff --git a/ompi/mpi/c/status_c2f.c.in b/ompi/mpi/c/status_c2f.c.in index d430bc7964f..9d4774a7cf7 100644 --- a/ompi/mpi/c/status_c2f.c.in +++ b/ompi/mpi/c/status_c2f.c.in @@ -33,11 +33,10 @@ #include "ompi/mpi/fortran/base/fint_2_int.h" #include "ompi/mpi/fortran/base/constants.h" #include "ompi/memchecker.h" +#include "ompi/util/status.h" PROTOTYPE ERROR_CLASS status_c2f(STATUS c_status, FINT_OUT f_status) { - const int *c_ints; - int i; MEMCHECKER( if(c_status != MPI_STATUSES_IGNORE) { /* @@ -61,33 +60,5 @@ PROTOTYPE ERROR_CLASS status_c2f(STATUS c_status, FINT_OUT f_status) MPI_ERR_IN_STATUS, FUNC_NAME); } } - - /* Note that MPI-2.2 16.3.5 states that even the hidden data in a - status must be converted (!). This is somewhat problematic - because the Fortran data is all INTEGERS while the C MPI_Status - contains a size_t. That being said, note 2 things: - - 1. The _ucount and _canceled members are never accessed from - Fortran. - 2. configure calculated a value of MPI_STATUS_SIZE to ensure - that the Fortran status is the Right size to hold the C - MPI_Status (including the size_t member). - - So for the purposes of this function, just copy over all the - data as if they were int's. This works because all OMPI - Fortran MPI API functions that take a status as an IN argument - first call MPI_Status_f2c on it before using it (in which case - we'll do the exact opposite copy, thereby rebuilding the size_t - value properly before it is accessed in C). - - Note that if sizeof(int) > sizeof(INTEGER), we're potentially - hosed anyway (i.e., even the public values in the status could - get truncated). But if sizeof(int) == sizeof(INTEGER) or - sizeof(int) < sizeof(INTEGER), everything should be kosher. */ - c_ints = (const int*)c_status; - for( i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int)); i++ ) { - f_status[i] = OMPI_INT_2_FINT(c_ints[i]); - } - - return MPI_SUCCESS; + return ompi_status_c2f(c_status, f_status); } diff --git a/ompi/mpi/c/status_f2c.c.in b/ompi/mpi/c/status_f2c.c.in index 3216193e3e9..c7e6f7ac700 100644 --- a/ompi/mpi/c/status_f2c.c.in +++ b/ompi/mpi/c/status_f2c.c.in @@ -31,11 +31,10 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/mpi/fortran/base/fint_2_int.h" #include "ompi/mpi/fortran/base/constants.h" +#include "ompi/util/status.h" PROTOTYPE ERROR_CLASS status_f2c(FINT_CONST f_status, STATUS_OUT c_status) { - int i, *c_ints; - if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); @@ -57,17 +56,5 @@ PROTOTYPE ERROR_CLASS status_f2c(FINT_CONST f_status, STATUS_OUT c_status) } } - /* ***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_ints = (int*)c_status; - for( i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int)); i++ ) { - c_ints[i] = (int)f_status[i]; - } - - return MPI_SUCCESS; + return ompi_status_f2c(f_status, c_status); } diff --git a/ompi/mpi/c/status_set_cancelled.c.in b/ompi/mpi/c/status_set_cancelled.c.in index 3c47560527c..960154e2d5a 100644 --- a/ompi/mpi/c/status_set_cancelled.c.in +++ b/ompi/mpi/c/status_set_cancelled.c.in @@ -28,7 +28,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" -PROTOTYPE ERROR_CLASS status_set_cancelled(STATUS_OUT status, INT flag) +PROTOTYPE ERROR_CLASS status_set_cancelled(STATUS_INOUT status, INT flag) { MEMCHECKER( if(status != MPI_STATUSES_IGNORE) { diff --git a/ompi/mpi/c/status_set_elements.c.in b/ompi/mpi/c/status_set_elements.c.in index 953a7aef7d0..da3c85053e1 100644 --- a/ompi/mpi/c/status_set_elements.c.in +++ b/ompi/mpi/c/status_set_elements.c.in @@ -32,7 +32,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" -PROTOTYPE ERROR_CLASS status_set_elements(STATUS_OUT status, DATATYPE datatype, COUNT count) +PROTOTYPE ERROR_CLASS status_set_elements(STATUS_INOUT status, DATATYPE datatype, COUNT count) { int rc = MPI_SUCCESS; size_t size; diff --git a/ompi/mpi/c/status_set_elements_x.c.in b/ompi/mpi/c/status_set_elements_x.c.in index c24b24f9c55..584035e8d53 100644 --- a/ompi/mpi/c/status_set_elements_x.c.in +++ b/ompi/mpi/c/status_set_elements_x.c.in @@ -32,7 +32,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" -PROTOTYPE ERROR_CLASS status_set_elements_x(STATUS_OUT status, DATATYPE datatype, PARTITIONED_COUNT count) +PROTOTYPE ERROR_CLASS status_set_elements_x(STATUS_INOUT status, DATATYPE datatype, PARTITIONED_COUNT count) { int rc = MPI_SUCCESS; size_t size; diff --git a/ompi/mpi/c/status_set_error.c.in b/ompi/mpi/c/status_set_error.c.in index 30a667cd5a5..31eccfee732 100644 --- a/ompi/mpi/c/status_set_error.c.in +++ b/ompi/mpi/c/status_set_error.c.in @@ -17,7 +17,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" -PROTOTYPE ERROR_CLASS status_set_error(STATUS_OUT status, INT error) +PROTOTYPE ERROR_CLASS status_set_error(STATUS_INOUT status, INT error) { MEMCHECKER( if(status != MPI_STATUSES_IGNORE) { diff --git a/ompi/mpi/c/status_set_source.c.in b/ompi/mpi/c/status_set_source.c.in index 46e1959bb85..b723a6bb3e6 100644 --- a/ompi/mpi/c/status_set_source.c.in +++ b/ompi/mpi/c/status_set_source.c.in @@ -17,7 +17,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" -PROTOTYPE ERROR_CLASS status_set_source(STATUS_OUT status, INT source) +PROTOTYPE ERROR_CLASS status_set_source(STATUS_INOUT status, INT source) { MEMCHECKER( if(status != MPI_STATUSES_IGNORE) { diff --git a/ompi/mpi/c/status_set_tag.c.in b/ompi/mpi/c/status_set_tag.c.in index 2a85c3cb62f..beca885583b 100644 --- a/ompi/mpi/c/status_set_tag.c.in +++ b/ompi/mpi/c/status_set_tag.c.in @@ -18,7 +18,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" -PROTOTYPE ERROR_CLASS status_set_tag(STATUS_OUT status, INT tag) +PROTOTYPE ERROR_CLASS status_set_tag(STATUS_INOUT status, INT tag) { MEMCHECKER( if(status != MPI_STATUSES_IGNORE) { diff --git a/ompi/mpi/c/type_create_keyval.c.in b/ompi/mpi/c/type_create_keyval.c.in index ea5cff2542d..f1494559c82 100644 --- a/ompi/mpi/c/type_create_keyval.c.in +++ b/ompi/mpi/c/type_create_keyval.c.in @@ -36,7 +36,7 @@ PROTOTYPE ERROR_CLASS type_create_keyval(TYPE_COPY_ATTR_FUNCTION type_copy_attr_ INT_OUT type_keyval, BUFFER_OUT extra_state) { - int ret; + int ret, flags = 0; ompi_attribute_fn_ptr_union_t copy_fn; ompi_attribute_fn_ptr_union_t del_fn; @@ -50,11 +50,16 @@ PROTOTYPE ERROR_CLASS type_create_keyval(TYPE_COPY_ATTR_FUNCTION type_copy_attr_ } } +#if OMPI_ABI_SRC + copy_fn.attr_datatype_copy_fn = ompi_abi_copy_attr_fn; + del_fn.attr_datatype_delete_fn = ompi_abi_delete_attr_fn; +#else copy_fn.attr_datatype_copy_fn = type_copy_attr_fn; del_fn.attr_datatype_delete_fn = type_delete_attr_fn; +#endif ret = ompi_attr_create_keyval(TYPE_ATTR, copy_fn, del_fn, - type_keyval, extra_state, 0, NULL); + type_keyval, extra_state, flags, NULL); OMPI_ERRHANDLER_NOHANDLE_RETURN(ret, ret, FUNC_NAME); } diff --git a/ompi/mpi/c/type_create_struct.c.in b/ompi/mpi/c/type_create_struct.c.in index accea45f603..98e31f567a6 100644 --- a/ompi/mpi/c/type_create_struct.c.in +++ b/ompi/mpi/c/type_create_struct.c.in @@ -40,7 +40,7 @@ PROTOTYPE ERROR_CLASS type_create_struct(COUNT count, COUNT_ARRAY array_of_blocklengths, AINT_COUNT_ARRAY array_of_displacements, - DATATYPE_ARRAY array_of_types, + DATATYPE_ARRAY array_of_types:count, DATATYPE_OUT newtype) { int i, rc, icount = (int)count; diff --git a/ompi/mpi/c/win_create_errhandler.c.in b/ompi/mpi/c/win_create_errhandler.c.in index 27a48e33aa4..3391c643524 100644 --- a/ompi/mpi/c/win_create_errhandler.c.in +++ b/ompi/mpi/c/win_create_errhandler.c.in @@ -30,7 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/win/win.h" -PROTOTYPE ERROR_CLASS win_create_errhandler(WIN_ERRHANLDER_FUNCTION function, +PROTOTYPE ERROR_CLASS win_create_errhandler(WIN_ERRHANDLER_FUNCTION function, ERRHANDLER_OUT errhandler) { int err = MPI_SUCCESS; diff --git a/ompi/mpi/c/win_create_keyval.c.in b/ompi/mpi/c/win_create_keyval.c.in index f58401685bf..f23b8c648d0 100644 --- a/ompi/mpi/c/win_create_keyval.c.in +++ b/ompi/mpi/c/win_create_keyval.c.in @@ -35,7 +35,7 @@ PROTOTYPE ERROR_CLASS win_create_keyval(WIN_COPY_ATTR_FUNCTION win_copy_attr_fn, WIN_DELETE_ATTR_FUNCTION win_delete_attr_fn, INT_OUT win_keyval, BUFFER_OUT extra_state) { - int ret; + int ret, flags = 0; ompi_attribute_fn_ptr_union_t copy_fn; ompi_attribute_fn_ptr_union_t del_fn; @@ -48,10 +48,15 @@ PROTOTYPE ERROR_CLASS win_create_keyval(WIN_COPY_ATTR_FUNCTION win_copy_attr_fn, } } +#if OMPI_ABI_SRC + copy_fn.attr_win_copy_fn = ompi_abi_copy_attr_fn; + del_fn.attr_win_delete_fn = ompi_abi_delete_attr_fn; +#else copy_fn.attr_win_copy_fn = win_copy_attr_fn; del_fn.attr_win_delete_fn = win_delete_attr_fn; +#endif ret = ompi_attr_create_keyval(WIN_ATTR, copy_fn, del_fn, - win_keyval, extra_state, 0, NULL); + win_keyval, extra_state, flags, NULL); OMPI_ERRHANDLER_NOHANDLE_RETURN(ret, MPI_ERR_OTHER, FUNC_NAME); } diff --git a/ompi/mpi/c/win_f2c.c b/ompi/mpi/c/win_f2c.c.in similarity index 88% rename from ompi/mpi/c/win_f2c.c rename to ompi/mpi/c/win_f2c.c.in index 82bf2b9cc71..f7b979d80aa 100644 --- a/ompi/mpi/c/win_f2c.c +++ b/ompi/mpi/c/win_f2c.c.in @@ -27,16 +27,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/mpi/fortran/base/fint_2_int.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Win_f2c = PMPI_Win_f2c -#endif -#define MPI_Win_f2c PMPI_Win_f2c -#endif - -static const char FUNC_NAME[] = "MPI_Win_f2c"; - -MPI_Win MPI_Win_f2c(MPI_Fint win) +PROTOTYPE WIN win_f2c(FINT win) { int o_index= OMPI_FINT_2_INT(win); diff --git a/ompi/mpiext/Makefile.am b/ompi/mpiext/Makefile.am index bbbdec3531c..e23729b2e91 100644 --- a/ompi/mpiext/Makefile.am +++ b/ompi/mpiext/Makefile.am @@ -16,5 +16,5 @@ headers += \ mpiext/mpiext.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ mpiext/mpiext.c diff --git a/ompi/op/Makefile.am b/ompi/op/Makefile.am index 5599c31311b..db4e92736a2 100644 --- a/ompi/op/Makefile.am +++ b/ompi/op/Makefile.am @@ -24,4 +24,4 @@ headers += op/op.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += op/op.c +libopen_mpi_la_SOURCES += op/op.c diff --git a/ompi/peruse/Makefile.am b/ompi/peruse/Makefile.am index 9b2d043ce43..aee74cc436c 100644 --- a/ompi/peruse/Makefile.am +++ b/ompi/peruse/Makefile.am @@ -21,7 +21,7 @@ if WANT_PERUSE # do NOT want this nobase - we want the peruse stripped off... include_HEADERS += peruse/peruse.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ peruse/peruse.c \ peruse/peruse_module.c endif diff --git a/ompi/proc/Makefile.am b/ompi/proc/Makefile.am index e9ad85d6f73..b10d46e37cf 100644 --- a/ompi/proc/Makefile.am +++ b/ompi/proc/Makefile.am @@ -23,5 +23,5 @@ headers += \ proc/proc.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ proc/proc.c diff --git a/ompi/request/Makefile.am b/ompi/request/Makefile.am index ab7bf73fe80..c30da608d08 100644 --- a/ompi/request/Makefile.am +++ b/ompi/request/Makefile.am @@ -34,18 +34,18 @@ headers += \ request/grequestx.h endif -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ request/grequest.c \ request/request.c \ request/req_test.c \ request/req_wait.c if WANT_FT_MPI -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ request/req_ft.c endif # WANT_FT_MPI if OMPI_ENABLE_GREQUEST_EXTENSIONS -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ request/grequestx.c endif diff --git a/ompi/request/grequest.c b/ompi/request/grequest.c index 6125d134a9c..2338f8e0e71 100644 --- a/ompi/request/grequest.c +++ b/ompi/request/grequest.c @@ -23,6 +23,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/request/grequest.h" #include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/util/status.h" /** * Internal function to specialize the call to the user provided free_fn @@ -262,9 +263,9 @@ int ompi_grequest_invoke_query(ompi_request_t *request, */ MPI_Fint ierr; MPI_Fint fstatus[sizeof(MPI_Status) / sizeof(int)]; - MPI_Status_c2f(status, fstatus); + ompi_status_c2f(status, fstatus); g->greq_query.f_query((MPI_Aint*)g->greq_state, fstatus, &ierr); - MPI_Status_f2c(fstatus, status); + ompi_status_f2c(fstatus, status); rc = OMPI_FINT_2_INT(ierr); } } diff --git a/ompi/runtime/Makefile.am b/ompi/runtime/Makefile.am index 957045ed116..225284b6066 100644 --- a/ompi/runtime/Makefile.am +++ b/ompi/runtime/Makefile.am @@ -31,7 +31,7 @@ headers += \ runtime/ompi_spc.h \ runtime/ompi_rte.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ runtime/ompi_mpi_init.c \ runtime/ompi_mpi_abort.c \ runtime/ompi_mpi_dynamics.c \ diff --git a/ompi/tools/wrappers/Makefile.am b/ompi/tools/wrappers/Makefile.am index 1d5b24a9372..f1482ff4164 100644 --- a/ompi/tools/wrappers/Makefile.am +++ b/ompi/tools/wrappers/Makefile.am @@ -89,7 +89,7 @@ if OMPI_WANT_JAVA_BINDINGS bin_SCRIPTS = mpijavac.pl endif -nodist_ompidata_DATA = mpicc-wrapper-data.txt +nodist_ompidata_DATA = mpicc-wrapper-data.txt mpicc_abi-wrapper-data.txt if OMPI_HAVE_CXX_COMPILER nodist_ompidata_DATA += mpic++-wrapper-data.txt @@ -102,6 +102,7 @@ endif install-exec-hook-always: test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" (cd $(DESTDIR)$(bindir); rm -f mpicc$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpicc$(EXEEXT)) + (cd $(DESTDIR)$(bindir); rm -f mpicc_abi$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpicc_abi$(EXEEXT)) if OMPI_HAVE_CXX_COMPILER (cd $(DESTDIR)$(bindir); rm -f mpic++$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpic++$(EXEEXT)) (cd $(DESTDIR)$(bindir); rm -f mpicxx$(EXEEXT); $(LN_S) opal_wrapper$(EXEEXT) mpicxx$(EXEEXT)) diff --git a/ompi/tools/wrappers/mpicc_abi-wrapper-data.txt.in b/ompi/tools/wrappers/mpicc_abi-wrapper-data.txt.in new file mode 100644 index 00000000000..916036f931e --- /dev/null +++ b/ompi/tools/wrappers/mpicc_abi-wrapper-data.txt.in @@ -0,0 +1,26 @@ +# There can be multiple blocks of configuration data, chosen by +# compiler flags (using the compiler_args key to chose which block +# should be activated. This can be useful for multilib builds. See the +# multilib page at: +# https://github.com/open-mpi/ompi/wiki/compilerwrapper3264 +# for more information. + +project=Open MPI +project_short=OMPI +version=@OMPI_VERSION@ +language=C +compiler_env=CC +compiler_flags_env=CFLAGS +compiler=@WRAPPER_CC@ +preprocessor_flags=-I${includedir}/standard_abi +compiler_flags_prefix=@OMPI_WRAPPER_CFLAGS_PREFIX@ +compiler_flags=@OMPI_WRAPPER_CFLAGS@ +linker_flags=@OMPI_WRAPPER_LDFLAGS@ +linker_flags_static=@OMPI_WRAPPER_LDFLAGS_STATIC@ +libs=-lmpi_abi +libs_static= +dyn_lib_file=libmpi_abi.@OPAL_DYN_LIB_SUFFIX@ +static_lib_file=libmpi_abi.a +required_file= +includedir=${includedir} +libdir=${libdir} diff --git a/ompi/util/Makefile.am b/ompi/util/Makefile.am index 53a89a074eb..70df3bed6a3 100644 --- a/ompi/util/Makefile.am +++ b/ompi/util/Makefile.am @@ -11,4 +11,5 @@ # Source code files headers += \ util/timings.h \ - util/count_disp_array.h + util/count_disp_array.h \ + util/status.h diff --git a/ompi/util/status.h b/ompi/util/status.h new file mode 100644 index 00000000000..c1089df5f5c --- /dev/null +++ b/ompi/util/status.h @@ -0,0 +1,56 @@ +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" + +static inline int ompi_status_c2f(const MPI_Status *c_status, MPI_Fint *f_status) +{ + const int *c_ints; + int i; + + /* Note that MPI-2.2 16.3.5 states that even the hidden data in a + status must be converted (!). This is somewhat problematic + because the Fortran data is all INTEGERS while the C MPI_Status + contains a size_t. That being said, note 2 things: + + 1. The _ucount and _canceled members are never accessed from + Fortran. + 2. configure calculated a value of MPI_STATUS_SIZE to ensure + that the Fortran status is the Right size to hold the C + MPI_Status (including the size_t member). + + So for the purposes of this function, just copy over all the + data as if they were int's. This works because all OMPI + Fortran MPI API functions that take a status as an IN argument + first call MPI_Status_f2c on it before using it (in which case + we'll do the exact opposite copy, thereby rebuilding the size_t + value properly before it is accessed in C). + + Note that if sizeof(int) > sizeof(INTEGER), we're potentially + hosed anyway (i.e., even the public values in the status could + get truncated). But if sizeof(int) == sizeof(INTEGER) or + sizeof(int) < sizeof(INTEGER), everything should be kosher. */ + c_ints = (const int*)c_status; + for( i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int)); i++ ) { + f_status[i] = OMPI_INT_2_FINT(c_ints[i]); + } + + return MPI_SUCCESS; +} + +static inline int ompi_status_f2c(const MPI_Fint *f_status, MPI_Status *c_status) +{ + int i, *c_ints; + + /* ***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_ints = (int*)c_status; + for( i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int)); i++ ) { + c_ints[i] = (int)f_status[i]; + } + + return MPI_SUCCESS; +} diff --git a/ompi/win/Makefile.am b/ompi/win/Makefile.am index 67126c71ec0..8675e77b63e 100644 --- a/ompi/win/Makefile.am +++ b/ompi/win/Makefile.am @@ -23,5 +23,5 @@ headers += \ win/win.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ win/win.c