diff --git a/.gitignore b/.gitignore index d15a1bc8f88..f798daeedc6 100644 --- a/.gitignore +++ b/.gitignore @@ -288,6 +288,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,3 +535,9 @@ docs/_templates # Common Python virtual environment directory names venv py?? + +# Generated C Bindings +ompi/mpi/c/ompi_*.c +ompi/mpi/c/standard_*.c +ompi/mpi/c/abi.h +ompi/mpi/c/standard_abi diff --git a/config/ompi_config_files.m4 b/config/ompi_config_files.m4 index 119d0ddabaf..f1b0cae38a1 100644 --- a/config/ompi_config_files.m4 +++ b/config/ompi_config_files.m4 @@ -52,6 +52,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 70353f0fe41..5e0d10db00a 100644 --- a/config/ompi_configure_options.m4 +++ b/config/ompi_configure_options.m4 @@ -244,5 +244,27 @@ else fi AM_CONDITIONAL(OMPI_OMPIO_SUPPORT, test "$ompi_want_ompio" = "1") +# If the ABI source files don't exist, then we need Python to generate them +AM_PATH_PYTHON([3.6],,[:]) +abi_file="${srcdir}/ompi/mpi/c/ompi_send.c" +AS_IF([! test -e "$abi_file" && test "$PYTHON" = ":"], + [AC_MSG_ERROR([Open MPI requires Python >=3.6 for generating the C ABI files. Aborting])]) +AM_CONDITIONAL(OMPI_GENERATE_C_INTERFACE_FILES,[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 8ebbd66c0c1..7c7c3864220 100644 --- a/ompi/Makefile.am +++ b/ompi/Makefile.am @@ -126,36 +126,70 @@ 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 = dist_ompidata_DATA = -lib@OMPI_LIBMPI_NAME@_la_SOURCES += $(headers) +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/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 675d9bad881..1b6bda1f14d 100644 --- a/ompi/communicator/Makefile.am +++ b/ompi/communicator/Makefile.am @@ -28,14 +28,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 002b050b568..db308a81d1a 100644 --- a/ompi/dpm/Makefile.am +++ b/ompi/dpm/Makefile.am @@ -16,6 +16,6 @@ dist_ompidata_DATA += 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 6f7264135c2..6bbd41d8602 100644 --- a/ompi/errhandler/Makefile.am +++ b/ompi/errhandler/Makefile.am @@ -29,7 +29,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 0b370840ad5..98ed4e79651 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -1388,7 +1388,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, @@ -1418,6 +1421,8 @@ OMPI_DECLSPEC int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr); OMPI_DECLSPEC int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); +OMPI_DECLSPEC int MPI_Allreduce_c(const void *sendbuf, void *recvbuf, MPI_Count count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm); OMPI_DECLSPEC int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int MPI_Allreduce_init(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, @@ -1773,10 +1778,14 @@ OMPI_DECLSPEC int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status); OMPI_DECLSPEC int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request); +OMPI_DECLSPEC int MPI_Irecv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source, + int tag, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int MPI_Irsend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); +OMPI_DECLSPEC int MPI_Isend_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest, + int tag, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int MPI_Isendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, @@ -1881,6 +1890,8 @@ OMPI_DECLSPEC int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, in int tag, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int MPI_Recv(void *buf, int 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_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, @@ -1956,6 +1967,8 @@ OMPI_DECLSPEC int MPI_Send_init(const void *buf, int count, MPI_Datatype dataty MPI_Request *request); OMPI_DECLSPEC int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); +OMPI_DECLSPEC int MPI_Send_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest, + int tag, MPI_Comm comm); OMPI_DECLSPEC int MPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, @@ -2152,6 +2165,9 @@ OMPI_DECLSPEC int PMPI_Abort(MPI_Comm comm, int errorcode); OMPI_DECLSPEC int PMPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win); +OMPI_DECLSPEC int PMPI_Accumulate_c(const void *origin_addr, MPI_Count origin_count, MPI_Datatype origin_datatype, + int target_rank, MPI_Aint target_disp, MPI_Count target_count, + MPI_Datatype target_datatype, MPI_Op op, MPI_Win win); OMPI_DECLSPEC int PMPI_Add_error_class(int *errorclass); OMPI_DECLSPEC int PMPI_Add_error_code(int errorclass, int *errorcode); OMPI_DECLSPEC int PMPI_Add_error_string(int errorcode, const char *string); @@ -2177,6 +2193,8 @@ OMPI_DECLSPEC int PMPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr); OMPI_DECLSPEC int PMPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); +OMPI_DECLSPEC int PMPI_Allreduce_c(const void *sendbuf, void *recvbuf, MPI_Count count, + MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); OMPI_DECLSPEC int PMPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int PMPI_Allreduce_init(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, @@ -2534,10 +2552,14 @@ OMPI_DECLSPEC int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status); OMPI_DECLSPEC int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request); +OMPI_DECLSPEC int PMPI_Irecv_c(void *buf, MPI_Count count, MPI_Datatype datatype, int source, + int tag, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int PMPI_Irsend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int PMPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); +OMPI_DECLSPEC int PMPI_Isend_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest, + int tag, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int PMPI_Isendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, @@ -2642,6 +2664,8 @@ OMPI_DECLSPEC int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, i int tag, MPI_Comm comm, MPI_Request *request); OMPI_DECLSPEC int PMPI_Recv(void *buf, int 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_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, @@ -2717,6 +2741,8 @@ OMPI_DECLSPEC int PMPI_Send_init(const void *buf, int count, MPI_Datatype datat MPI_Request *request); OMPI_DECLSPEC int PMPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); +OMPI_DECLSPEC int PMPI_Send_c(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest, + int tag, MPI_Comm comm); OMPI_DECLSPEC int PMPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, @@ -3175,6 +3201,8 @@ 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/info/Makefile.am b/ompi/info/Makefile.am index e4af170dcf8..051ec52e2b9 100644 --- a/ompi/info/Makefile.am +++ b/ompi/info/Makefile.am @@ -23,5 +23,5 @@ headers += \ info/info.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ info/info.c 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 a37dba65668..3a43f15c8a8 100644 --- a/ompi/mca/bml/r2/Makefile.am +++ b/ompi/mca/bml/r2/Makefile.am @@ -36,7 +36,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 341c5def950..4211803ac58 100644 --- a/ompi/mca/coll/basic/Makefile.am +++ b/ompi/mca/coll/basic/Makefile.am @@ -64,7 +64,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/cuda/Makefile.am b/ompi/mca/coll/cuda/Makefile.am index 74a6ecfd947..51321f6731e 100644 --- a/ompi/mca/coll/cuda/Makefile.am +++ b/ompi/mca/coll/cuda/Makefile.am @@ -32,7 +32,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_cuda_la_SOURCES = $(sources) mca_coll_cuda_la_LDFLAGS = -module -avoid-version -mca_coll_cuda_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +mca_coll_cuda_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_cuda_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 d9c691cf458..2d3b3bfb0ca 100644 --- a/ompi/mca/coll/inter/Makefile.am +++ b/ompi/mca/coll/inter/Makefile.am @@ -33,7 +33,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/sm/Makefile.am b/ompi/mca/coll/sm/Makefile.am index 0dfbfff566a..53cdc2c9efe 100644 --- a/ompi/mca/coll/sm/Makefile.am +++ b/ompi/mca/coll/sm/Makefile.am @@ -62,7 +62,7 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_coll_sm_la_SOURCES = $(sources) mca_coll_sm_la_LDFLAGS = -module -avoid-version -mca_coll_sm_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_coll_sm_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(OMPI_TOP_BUILDDIR)/opal/mca/common/sm/lib@OPAL_LIB_NAME@mca_common_sm.la noinst_LTLIBRARIES = $(component_noinst) diff --git a/ompi/mca/coll/sync/Makefile.am b/ompi/mca/coll/sync/Makefile.am index 2f75cd2dfa5..e7b90e44cb3 100644 --- a/ompi/mca/coll/sync/Makefile.am +++ b/ompi/mca/coll/sync/Makefile.am @@ -47,7 +47,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/fbtl/pvfs2/Makefile.am b/ompi/mca/fbtl/pvfs2/Makefile.am index 66582947d93..52c4a7e2277 100644 --- a/ompi/mca/fbtl/pvfs2/Makefile.am +++ b/ompi/mca/fbtl/pvfs2/Makefile.am @@ -46,7 +46,7 @@ AM_CPPFLAGS = $(fbtl_pvfs2_CPPFLAGS) mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_fbtl_pvfs2_la_SOURCES = $(fbtl_pvfs2_sources) -mca_fbtl_pvfs2_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_fbtl_pvfs2_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(fbtl_pvfs2_LIBS) mca_fbtl_pvfs2_la_LDFLAGS = -module -avoid-version $(fbtl_pvfs2_LDFLAGS) 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/pvfs2/Makefile.am b/ompi/mca/fs/pvfs2/Makefile.am index 64c147493ac..823589cafe2 100644 --- a/ompi/mca/fs/pvfs2/Makefile.am +++ b/ompi/mca/fs/pvfs2/Makefile.am @@ -48,7 +48,7 @@ AM_CPPFLAGS = $(fs_pvfs2_CPPFLAGS) mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_fs_pvfs2_la_SOURCES = $(fs_pvfs2_sources) -mca_fs_pvfs2_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ +mca_fs_pvfs2_la_LIBADD = $(top_builddir)/ompi/libopen-mpi.la \ $(fs_pvfs2_LIBS) mca_fs_pvfs2_la_LDFLAGS = -module -avoid-version $(fs_pvfs2_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 f0bf8e13d0f..c4c411771f6 100644 --- a/ompi/mca/hook/comm_method/hook_comm_method_fns.c +++ b/ompi/mca/hook/comm_method/hook_comm_method_fns.c @@ -509,6 +509,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); @@ -519,6 +520,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 7f374868149..df9d607ddc9 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 741c65e4638..b739585a2ee 100644 --- a/ompi/mca/mtl/psm2/Makefile.am +++ b/ompi/mca/mtl/psm2/Makefile.am @@ -57,7 +57,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 b2cd3152d39..1feade344ce 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/c/Makefile.am b/ompi/mpi/c/Makefile.am index 8e7487a31a2..f92f501e517 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -35,21 +35,103 @@ # into the PMPI_ namespace. noinst_LTLIBRARIES = libmpi_c.la libmpi_c_profile.la +if OMPI_STANDARD_ABI +noinst_LTLIBRARIES += libmpi_c_abi.la libmpi_c_abi_profile.la +endif if BUILD_MPI_BINDINGS_LAYER -noinst_LTLIBRARIES += libmpi_c_noprofile.la +noinst_LTLIBRARIES += libmpi_c_noprofile.la libmpi_c_abi_noprofile.la endif headers = bindings.h +prototype_sources = \ + abort.c.in \ + send.c.in \ + isend.c.in \ + recv.c.in \ + irecv.c.in \ + waitsome.c.in \ + accumulate.c.in \ + comm_f2c.c.in \ + wtime.c.in \ + file_open.c.in \ + init.c.in \ + finalize.c.in \ + comm_rank.c.in \ + comm_size.c.in \ + waitall.c.in \ + comm_split.c.in \ + comm_split_type.c.in \ + comm_free.c.in \ + finalized.c.in \ + initialized.c.in \ + allreduce.c.in \ + get_library_version.c.in \ + get_processor_name.c.in \ + barrier.c.in + +# Include script and template files in case someone wants to update the +# ABI files +EXTRA_DIST = abi.py $(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 libmpi_c_la_LIBADD = libmpi_c_profile.la if BUILD_MPI_BINDINGS_LAYER libmpi_c_la_LIBADD += libmpi_c_noprofile.la endif +libmpi_c_abi_la_SOURCES = \ + abi.h \ + 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 = \ + standard_abort.c \ + standard_init.c \ + standard_finalize.c \ + standard_finalized.c \ + standard_send.c \ + standard_isend.c \ + standard_recv.c \ + standard_irecv.c \ + standard_waitsome.c \ + standard_accumulate.c \ + standard_comm_f2c.c \ + standard_wtime.c \ + standard_file_open.c \ + standard_comm_rank.c \ + standard_comm_size.c \ + standard_waitall.c \ + standard_comm_split.c \ + standard_comm_split_type.c \ + standard_comm_free.c \ + standard_initialized.c \ + standard_allreduce.c \ + standard_get_library_version.c \ + standard_get_processor_name.c \ + standard_barrier.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 + # Conditionally install the header files if WANT_INSTALL_HEADERS ompidir = $(ompiincludedir)/$(subdir) @@ -60,7 +142,7 @@ endif # List of all C files that have profile versions # interface_profile_sources = \ - abort.c \ + ompi_abort.c \ add_error_class.c \ add_error_code.c \ add_error_string.c \ @@ -71,7 +153,7 @@ interface_profile_sources = \ iallgatherv.c \ allgatherv_init.c \ alloc_mem.c \ - allreduce.c \ + ompi_allreduce.c \ iallreduce.c \ allreduce_init.c \ alltoall.c \ @@ -86,7 +168,7 @@ interface_profile_sources = \ attr_delete.c \ attr_get.c \ attr_put.c \ - barrier.c \ + ompi_barrier.c \ ibarrier.c \ barrier_init.c \ bcast.c \ @@ -122,8 +204,8 @@ interface_profile_sources = \ comm_dup_with_info.c \ comm_idup.c \ comm_idup_with_info.c \ - comm_f2c.c \ - comm_free.c \ + ompi_comm_f2c.c \ + ompi_comm_free.c \ comm_free_keyval.c \ comm_get_attr.c \ comm_get_errhandler.c \ @@ -132,7 +214,7 @@ interface_profile_sources = \ comm_get_parent.c \ comm_group.c \ comm_join.c \ - comm_rank.c \ + ompi_comm_rank.c \ comm_remote_group.c \ comm_remote_size.c \ comm_set_attr.c \ @@ -143,11 +225,11 @@ interface_profile_sources = \ dist_graph_neighbors_count.c \ comm_set_errhandler.c \ comm_set_name.c \ - comm_size.c \ + ompi_comm_size.c \ comm_spawn.c \ comm_spawn_multiple.c \ - comm_split.c \ - comm_split_type.c \ + ompi_comm_split.c \ + ompi_comm_split_type.c \ comm_test_inter.c \ compare_and_swap.c \ dims_create.c \ @@ -187,7 +269,7 @@ interface_profile_sources = \ file_iwrite.c \ file_iwrite_all.c \ file_iwrite_shared.c \ - file_open.c \ + ompi_file_open.c \ file_preallocate.c \ file_read_all_begin.c \ file_read_all.c \ @@ -221,8 +303,8 @@ interface_profile_sources = \ file_write_ordered.c \ file_write_ordered_end.c \ file_write_shared.c \ - finalize.c \ - finalized.c \ + ompi_finalize.c \ + ompi_finalized.c \ free_mem.c \ gather.c \ igather.c \ @@ -235,8 +317,8 @@ interface_profile_sources = \ get_elements.c \ get_elements_x.c \ get_accumulate.c \ - get_library_version.c \ - get_processor_name.c \ + ompi_get_library_version.c \ + ompi_get_processor_name.c \ get_version.c \ graph_create.c \ graph_get.c \ @@ -277,17 +359,17 @@ interface_profile_sources = \ info_get_string.c \ info_get_valuelen.c \ info_set.c \ - init.c \ + ompi_init.c \ init_thread.c \ - initialized.c \ + ompi_initialized.c \ intercomm_create.c \ intercomm_create_from_groups.c \ intercomm_merge.c \ iprobe.c \ - irecv.c \ + ompi_irecv.c \ irsend.c \ is_thread_main.c \ - isend.c \ + ompi_isend.c \ isendrecv.c \ isendrecv_replace.c \ issend.c \ @@ -335,7 +417,7 @@ interface_profile_sources = \ query_thread.c \ raccumulate.c \ recv_init.c \ - recv.c \ + ompi_recv.c \ reduce.c \ ireduce.c \ reduce_init.c \ @@ -365,7 +447,6 @@ interface_profile_sources = \ scatterv.c \ iscatterv.c \ scatterv_init.c \ - send.c \ send_init.c \ sendrecv.c \ sendrecv_replace.c \ @@ -440,12 +521,12 @@ interface_profile_sources = \ unpack.c \ unpublish_name.c \ wait.c \ - waitall.c \ + ompi_waitall.c \ waitany.c \ - waitsome.c \ - wtime.c \ + ompi_waitsome.c \ + ompi_wtime.c \ wtick.c \ - accumulate.c \ + ompi_accumulate.c \ get.c \ put.c \ win_allocate.c \ @@ -486,6 +567,7 @@ interface_profile_sources = \ win_test.c \ win_unlock.c \ win_unlock_all.c \ + ompi_send.c \ win_wait.c # The following functions were removed from the MPI standard, but are @@ -509,3 +591,21 @@ libmpi_c_profile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=1 libmpi_c_noprofile_la_SOURCES = $(interface_profile_sources) libmpi_c_noprofile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=0 + +nobase_include_HEADERS = standard_abi/mpi.h + +# ABI generation rules +if OMPI_GENERATE_C_INTERFACE_FILES +ompi_%.c: %.c.in abi.py abi.h + $(PYTHON) $(srcdir)/abi.py source ompi $< > $@ +standard_%.c: %.c.in abi.py abi.h + $(PYTHON) $(srcdir)/abi.py source standard $< > $@ +abi.h: abi.py $(prototype_sources) + $(PYTHON) $(srcdir)/abi.py header --srcdir=$(srcdir) $(prototype_sources) > $@ +standard_abi/mpi.h: abi.py $(prototype_sources) + mkdir -p standard_abi + $(PYTHON) $(srcdir)/abi.py header --srcdir=$(srcdir) --external $(prototype_sources) > $@ + +distclean-local: + -rm -rf ompi_*.c standard_*.c abi.h standard_abi/ +endif diff --git a/ompi/mpi/c/abi.py b/ompi/mpi/c/abi.py new file mode 100755 index 00000000000..f40986ff981 --- /dev/null +++ b/ompi/mpi/c/abi.py @@ -0,0 +1,1278 @@ +#!/usr/bin/env python3 +# Copyright (c) 2023 Triad National Security, LLC. All rights reserved. +# Copyright (c) 2023 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADERS$ +# +# +"""MPI Standard ABI Generation. + +TEMPLATE SOURCE FILE ASSUMPTIONS: +* Only one function per file +* Nothing (other than blank lines) after closing '}' +* Function prototype is preceded by PROTOTYPE +* All types in the function prototype are converted to one-word capital types + as defined here (to be later converted to ompi or standard ABI types) +* Functions requiring a bigcount implementation should have type COUNT in + place of MPI_Count or int for each count parameter. Bigcount functions will + be generated automatically for any function that includes a COUNT type. +""" +from abc import ABC, abstractmethod +import argparse +import re +import sys +import os + +# C type: const int +ERROR_CLASSES = [ + 'MPI_SUCCESS', + 'MPI_ERR_BUFFER', + 'MPI_ERR_COUNT', + 'MPI_ERR_TYPE', + 'MPI_ERR_TAG', + 'MPI_ERR_COMM', + 'MPI_ERR_RANK', + 'MPI_ERR_REQUEST', + 'MPI_ERR_ROOT', + 'MPI_ERR_GROUP', + 'MPI_ERR_OP', + 'MPI_ERR_TOPOLOGY', + 'MPI_ERR_DIMS', + 'MPI_ERR_ARG', + 'MPI_ERR_UNKNOWN', + 'MPI_ERR_TRUNCATE', + 'MPI_ERR_OTHER', + 'MPI_ERR_INTERN', + 'MPI_ERR_PENDING', + 'MPI_ERR_IN_STATUS', + 'MPI_ERR_ACCESS', + 'MPI_ERR_AMODE', + 'MPI_ERR_ASSERT', + 'MPI_ERR_BAD_FILE', + 'MPI_ERR_BASE', + 'MPI_ERR_CONVERSION', + 'MPI_ERR_DISP', + 'MPI_ERR_DUP_DATAREP', + 'MPI_ERR_FILE_EXISTS', + 'MPI_ERR_FILE_IN_USE', + 'MPI_ERR_FILE', + 'MPI_ERR_INFO_KEY', + 'MPI_ERR_INFO_NOKEY', + 'MPI_ERR_INFO_VALUE', + 'MPI_ERR_INFO', + 'MPI_ERR_IO', + 'MPI_ERR_KEYVAL', + 'MPI_ERR_LOCKTYPE', + 'MPI_ERR_NAME', + 'MPI_ERR_NO_MEM', + 'MPI_ERR_NOT_SAME', + 'MPI_ERR_NO_SPACE', + 'MPI_ERR_NO_SUCH_FILE', + 'MPI_ERR_PORT', + 'MPI_ERR_PROC_ABORTED', + 'MPI_ERR_QUOTA', + 'MPI_ERR_READ_ONLY', + 'MPI_ERR_RMA_ATTACH', + 'MPI_ERR_RMA_CONFLICT', + 'MPI_ERR_RMA_RANGE', + 'MPI_ERR_RMA_SHARED', + 'MPI_ERR_RMA_SYNC', + 'MPI_ERR_RMA_FLAVOR', + 'MPI_ERR_SERVICE', + 'MPI_ERR_SESSION', + 'MPI_ERR_SIZE', + 'MPI_ERR_SPAWN', + 'MPI_ERR_UNSUPPORTED_DATAREP', + 'MPI_ERR_UNSUPPORTED_OPERATION', + 'MPI_ERR_WIN', + 'MPI_T_ERR_CANNOT_INIT', + 'MPI_T_ERR_NOT_INITIALIZED', + 'MPI_T_ERR_MEMORY', + 'MPI_T_ERR_INVALID', + 'MPI_T_ERR_INVALID_INDEX', + 'MPI_T_ERR_INVALID_ITEM', + 'MPI_T_ERR_INVALID_SESSION', + 'MPI_T_ERR_INVALID_HANDLE', + 'MPI_T_ERR_INVALID_NAME', + 'MPI_T_ERR_OUT_OF_HANDLES', + 'MPI_T_ERR_OUT_OF_SESSIONS', + 'MPI_T_ERR_CVAR_SET_NOT_NOW', + 'MPI_T_ERR_CVAR_SET_NEVER', + 'MPI_T_ERR_PVAR_NO_WRITE', + 'MPI_T_ERR_PVAR_NO_STARTSTOP', + 'MPI_T_ERR_PVAR_NO_ATOMIC', + 'MPI_ERR_LASTCODE', +] + +PREDEFINED_DATATYPES = [ + 'MPI_CHAR', + 'MPI_SHORT', + 'MPI_INT', + 'MPI_LONG', + 'MPI_LONG_LONG_INT', + 'MPI_LONG_LONG', + 'MPI_SIGNED_CHAR', + 'MPI_UNSIGNED_CHAR', + 'MPI_UNSIGNED_SHORT', + 'MPI_UNSIGNED', + 'MPI_UNSIGNED_LONG', + 'MPI_UNSIGNED_LONG_LONG', + 'MPI_FLOAT', + 'MPI_DOUBLE', + 'MPI_LONG_DOUBLE', + 'MPI_WCHAR', + 'MPI_C_BOOL', + 'MPI_INT8_T', + 'MPI_INT16_T', + 'MPI_INT32_T', + 'MPI_INT64_T', + 'MPI_UINT8_T', + 'MPI_UINT16_T', + 'MPI_UINT32_T', + 'MPI_UINT64_T', + 'MPI_AINT', + 'MPI_COUNT', + 'MPI_OFFSET', + 'MPI_C_COMPLEX', + 'MPI_C_FLOAT_COMPLEX', + 'MPI_C_DOUBLE_COMPLEX', + 'MPI_C_LONG_DOUBLE_COMPLEX', + 'MPI_BYTE', + 'MPI_PACKED', + 'MPI_CXX_BOOL', + 'MPI_CXX_FLOAT_COMPLEX', + 'MPI_CXX_DOUBLE_COMPLEX', + 'MPI_CXX_LONG_DOUBLE_COMPLEX', + 'MPI_FLOAT_INT', + 'MPI_DOUBLE_INT', + 'MPI_LONG_INT', + 'MPI_2INT', + 'MPI_SHORT_INT', + 'MPI_LONG_DOUBLE_INT', +] + +# C type: MPI_Comm +RESERVED_COMMUNICATORS = [ + 'MPI_COMM_NULL', + 'MPI_COMM_WORLD', + 'MPI_COMM_SELF', +] + +COMMUNICATOR_SPLIT_TYPES = [ + 'MPI_COMM_TYPE_SHARED', + 'MPI_COMM_TYPE_HW_UNGUIDED', + 'MPI_COMM_TYPE_HW_GUIDED', +] + +RESERVED_WINDOWS = [ + 'MPI_WIN_NULL', +] + +RESERVED_REQUESTS = [ + 'MPI_REQUEST_NULL', +] + +RESERVED_INFOS = [ + 'MPI_INFO_ENV', + 'MPI_INFO_NULL', +] + +RESERVED_FILES = [ + 'MPI_FILE_NULL', +] + +IGNORED_STATUS_HANDLES = [ + 'MPI_STATUSES_IGNORE', + 'MPI_STATUS_IGNORE', +] + +COLLECTIVE_OPERATIONS = [ + 'MPI_MAX', + 'MPI_MIN', + 'MPI_SUM', + 'MPI_PROD', + 'MPI_MAXLOC', + 'MPI_MINLOC', + 'MPI_BAND', + 'MPI_BOR', + 'MPI_BXOR', + 'MPI_LAND', + 'MPI_LOR', + 'MPI_LXOR', + 'MPI_REPLACE', + 'MPI_NO_OP', +] + +VARIOUS_CONSTANTS = { + # Just setting this to the same as ompi ABI for right now, but will need to + # match the standard ABI value when defined + 'MPI_MAX_LIBRARY_VERSION_STRING': 256, + 'MPI_MAX_PROCESSOR_NAME': 256, +} + +# Types + +C_OPAQUE_TYPES = { + 'MPI_Aint': 'intptr_t', + 'MPI_Offset': 'int64_t', + 'MPI_Count': 'size_t', + # The below type needs to be set externally depending on Fortran compiler + 'MPI_Fint': 'int64_t', +} + +C_HANDLES = [ + 'MPI_Comm', + 'MPI_Datatype', + 'MPI_Errhandler', + 'MPI_File', + 'MPI_Group', + 'MPI_Info', + 'MPI_Message', + 'MPI_Op', + 'MPI_Request', + 'MPI_Session', + 'MPI_Win', +] + + +class ConvertFuncs: + """Names of conversion functions (between standard ABI and OMPI ABI).""" + + ERROR_CLASS = 'ompi_convert_intern_error_abi_error' + COMM = 'ompi_convert_abi_comm_intern_comm' + DATATYPE = 'ompi_convert_abi_datatype_intern_datatype' + REQUEST = 'ompi_convert_abi_request_intern_request' + STATUS = 'ompi_convert_intern_status_abi_status' + OP = 'ompi_convert_abi_op_intern_op' + WIN = 'ompi_convert_abi_win_intern_win' + INFO = 'ompi_convert_abi_info_intern_info' + FILE = 'ompi_convert_abi_file_intern_file' + + +class ConvertOMPIToStandard: + """Generated function for converting from OMPI to standard ABI.""" + + COMM = 'ompi_convert_comm_ompi_to_standard' + + +# Inline function attributes +INLINE_ATTRS = '__opal_attribute_always_inline__ static inline' + + +def mpi_fn_name_from_base_fn_name(name): + """Convert from a base name to the standard 'MPI_*' name.""" + return f'MPI_{name.capitalize()}' + + +def abi_internal_name(extname): + """Convert from the ABI external name to an internal name. + + Used to avoid conflicts with existing MPI names. + """ + return f'{extname}_ABI_INTERNAL' + + +class ABIHeaderBuilder: + """ABI header builder code.""" + + def __init__(self, prototypes, external=False, file=sys.stdout): + self.file = file + self.external = external + + if external: + mangle_name = lambda name: name + else: + mangle_name = abi_internal_name + + # Build up the list of standard ABI signatures + signatures = [] + for prototype in prototypes: + base_name = mpi_fn_name_from_base_fn_name(prototype.name) + signatures.append(prototype.signature('standard', base_name, + mangle_name=mangle_name)) + # Profiling prototype + signatures.append(prototype.signature('standard', f'P{base_name}', + mangle_name=mangle_name)) + if prototype.need_bigcount: + signatures.append(prototype.signature('standard', f'{base_name}_c', + count_type='MPI_Count', + mangle_name=mangle_name)) + # Profiling prototype + signatures.append(prototype.signature('standard', f'P{base_name}_c', + count_type='MPI_Count', + mangle_name=mangle_name)) + self.signatures = signatures + + def mangle_name(self, extname): + """Mangle names, depending on whether building external or internal header.""" + if self.external: + return extname + return abi_internal_name(extname) + + def dump(self, *pargs, **kwargs): + print(*pargs, **kwargs, file=self.file) + + def dump_lines(self, lines): + lines = indent_lines(lines, 4 * ' ', start=1) + for line in lines: + self.dump(line) + + def generate_error_convert_fn(self): + self.dump(f'{INLINE_ATTRS} int {ConvertFuncs.ERROR_CLASS}(int error_class)') + self.dump('{') + lines = [] + lines.append('switch (error_class) {') + for error in ERROR_CLASSES: + lines.append(f'case {self.mangle_name(error)}:') + lines.append(f'return {error};') + lines.append('default:') + lines.append('return error_class;') + lines.append('}') + self.dump_lines(lines) + self.dump('}') + + def generic_convert(self, fn_name, param_name, type_, value_names): + intern_type = self.mangle_name(type_) + self.dump(f'{INLINE_ATTRS} {type_} {fn_name}({intern_type} {param_name})') + self.dump('{') + lines = [] + for i, value_name in enumerate(value_names): + intern_name = self.mangle_name(value_name) + if i == 0: + lines.append('if (%s == %s) {' % (intern_name, param_name)) + else: + lines.append('} else if (%s == %s) {' % (intern_name, param_name)) + lines.append(f'return {value_name};') + lines.append('}') + lines.append(f'return ({type_}) {param_name};') + self.dump_lines(lines) + self.dump('}') + + def generic_convert_reverse(self, fn_name, param_name, type_, value_names): + intern_type = self.mangle_name(type_) + self.dump(f'{INLINE_ATTRS} {intern_type} {fn_name}({type_} {param_name})') + self.dump('{') + lines = [] + for i, value_name in enumerate(value_names): + intern_name = self.mangle_name(value_name) + if i == 0: + lines.append('if (%s == %s) {' % (value_name, param_name)) + else: + lines.append('} else if (%s == %s) {' % (value_name, param_name)) + lines.append(f'return {intern_name};') + lines.append('}') + lines.append(f'return ({intern_type}) {param_name};') + self.dump_lines(lines) + self.dump('}') + + def generate_comm_convert_fn(self): + self.generic_convert(ConvertFuncs.COMM, 'comm', 'MPI_Comm', RESERVED_COMMUNICATORS) + + def generate_comm_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertOMPIToStandard.COMM, 'comm', 'MPI_Comm', RESERVED_COMMUNICATORS) + + def generate_info_convert_fn(self): + self.generic_convert(ConvertFuncs.INFO, 'info', 'MPI_Info', RESERVED_INFOS) + + def generate_file_convert_fn_intern_to_abi(self): + self.generic_convert_reverse(ConvertFuncs.FILE, 'file', 'MPI_File', RESERVED_FILES) + + def generate_datatype_convert_fn(self): + self.generic_convert(ConvertFuncs.DATATYPE, 'datatype', 'MPI_Datatype', PREDEFINED_DATATYPES) + + def generate_op_convert_fn(self): + self.generic_convert(ConvertFuncs.OP, 'op', 'MPI_Op', COLLECTIVE_OPERATIONS) + + def generate_win_convert_fn(self): + self.generic_convert(ConvertFuncs.WIN, 'win', 'MPI_Win', RESERVED_WINDOWS) + + def generate_pointer_convert_fn(self, type_, fn_name, constants): + abi_type = self.mangle_name(type_) + self.dump(f'{INLINE_ATTRS} void {fn_name}({abi_type} *ptr)') + self.dump('{') + lines = [] + for i, ompi_name in enumerate(constants): + abi_name = self.mangle_name(ompi_name) + if i == 0: + lines.append('if (%s == (%s) *ptr) {' % (ompi_name, type_)) + else: + lines.append('} else if (%s == (%s) *ptr) {' % (ompi_name, type_)) + lines.append(f'*ptr = {abi_name};') + lines.append('}') + self.dump_lines(lines) + self.dump('}') + + def generate_request_convert_fn(self): + self.generate_pointer_convert_fn('MPI_Request', ConvertFuncs.REQUEST, RESERVED_REQUESTS) + + def generate_file_convert_fn(self): + self.generate_pointer_convert_fn('MPI_File', ConvertFuncs.FILE, RESERVED_FILES) + + def generate_status_convert_fn(self): + type_ = 'MPI_Status' + abi_type = self.mangle_name(type_) + self.dump(f'{INLINE_ATTRS} void {ConvertFuncs.STATUS}({abi_type} *out, {type_} *inp)') + self.dump('{') + self.dump(' out->MPI_SOURCE = inp->MPI_SOURCE;') + self.dump(' out->MPI_TAG = inp->MPI_TAG;') + self.dump(f' out->MPI_ERROR = {ConvertFuncs.ERROR_CLASS}(inp->MPI_ERROR);') + # TODO: What to do with the private fields? + self.dump('}') + + def define(self, type_, name, value): + self.dump(f'#define {name} OMPI_CAST_CONSTANT({type_}, {value})') + + def define_all(self, type_, constants): + for i, const in enumerate(constants): + self.define(self.mangle_name(type_), self.mangle_name(const), i + 1) + self.dump() + + def dump_header(self): + header_guard = '_ABI_INTERNAL_' + self.dump(f'#ifndef {header_guard}') + self.dump(f'#define {header_guard}') + + self.dump('#include "stddef.h"') + self.dump('#include "stdint.h"') + + self.dump(""" +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif +""") + + self.dump(""" +#if defined(c_plusplus) || defined(__cplusplus) +#define OMPI_CAST_CONSTANT(type, value) (static_cast (static_cast (value))) +#else +#define OMPI_CAST_CONSTANT(type, value) ((type) ((void *) value)) +#endif +""") + + for i, err in enumerate(ERROR_CLASSES): + self.dump(f'#define {self.mangle_name(err)} {i + 1}') + self.dump() + + self.define_all('MPI_Datatype', PREDEFINED_DATATYPES) + self.define_all('MPI_Op', COLLECTIVE_OPERATIONS) + self.define_all('MPI_Comm', RESERVED_COMMUNICATORS) + self.define_all('MPI_Request', RESERVED_REQUESTS) + self.define_all('MPI_Win', RESERVED_WINDOWS) + self.define_all('MPI_Info', RESERVED_INFOS) + self.define_all('MPI_File', RESERVED_FILES) + + for name, value in VARIOUS_CONSTANTS.items(): + self.dump(f'#define {self.mangle_name(name)} {value}') + self.dump() + + status_type = self.mangle_name('MPI_Status') + for i, name in enumerate(IGNORED_STATUS_HANDLES): + self.define(f'{status_type} *', self.mangle_name(name), i + 1) + self.dump() + + for i, name in enumerate(COMMUNICATOR_SPLIT_TYPES): + self.dump(f'#define {self.mangle_name(name)} {i}') + self.dump() + + for mpi_type, c_type in C_OPAQUE_TYPES.items(): + self.dump(f'typedef {c_type} {self.mangle_name(mpi_type)};') + self.dump() + + for handle in C_HANDLES: + prefix, suffix = handle.split('_') + name = f'{prefix}_ABI_{suffix}' + self.dump(f'typedef struct {self.mangle_name(name)} *{self.mangle_name(handle)};') + self.dump() + self.dump(""" +struct MPI_Status_ABI { + int MPI_SOURCE; + int MPI_TAG; + int MPI_ERROR; + int mpi_abi_private[5]; +};""") + self.dump(f'typedef struct MPI_Status_ABI {self.mangle_name("MPI_Status")};') + self.dump() + # 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_file_convert_fn() + self.generate_datatype_convert_fn() + self.generate_op_convert_fn() + self.generate_win_convert_fn() + self.generate_request_convert_fn() + self.generate_status_convert_fn() + + self.dump(""" +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif +""") + self.dump(f'#endif /* {header_guard} */') + + +class Parameter: + + def __init__(self, text): + """Parse a parameter.""" + # parameter in the form "TYPE NAME" or "TYPE NAME:COUNT_VAR" + type_, namecount = text.split() + if ':' in namecount: + name, count_param = namecount.split(':') + else: + name, count_param = namecount, None + self.type_ = type_ + self.name = name + self.count_param = count_param + + def construct(self, abi_type, **kwargs): + """Construct the type parameter for the given ABI.""" + return Type.construct(abi_type, type_=self.type_, name=self.name, + count_param=self.count_param, **kwargs) + + +class ReturnType: + """Return type wrapper.""" + + def __init__(self, type_): + self.type_ = type_ + + def construct(self, abi_type, **kwargs): + """Construct the return type for the given ABI.""" + return Type.construct(abi_type, type_=self.type_, **kwargs) + + +class Type(ABC): + """Type representation.""" + + PARAMS_OMPI_ABI = {} + + PARAMS_STANDARD_ABI = {} + + def __init__(self, type_, name=None, + mangle_name=lambda name: abi_internal_name(name), + count_param=None, **kwargs): + self.type = type_ + self.name = name + self.count_param = count_param + self.mangle_name = mangle_name + + @staticmethod + def construct(abi_type, type_, **kwargs): + """Construct the parameter for the given ABI and type.""" + if abi_type == 'ompi': + return Type.PARAMS_OMPI_ABI[type_](type_, **kwargs) + elif abi_type == 'standard': + return Type.PARAMS_STANDARD_ABI[type_](type_, **kwargs) + else: + raise RuntimeError(f'invalid ABI type {abi_type}') + + @staticmethod + def add_type(type_name, abi_type=('ompi', 'standard')): + """Add a new class corresponding to a type.""" + def wrapper(class_): + if 'ompi' in abi_type: + Type.PARAMS_OMPI_ABI[type_name] = class_ + if 'standard' in abi_type: + Type.PARAMS_STANDARD_ABI[type_name] = class_ + # Parameter.TYPES[type_] = class_ + return class_ + return wrapper + + @property + def is_count(self): + """Return True if this parameter is a count (requiring bigcount API).""" + return False + + @property + def init_code(self): + """Return the initialization code needed for an ABI wrapper.""" + return [] + + @property + def final_code(self): + """Return the finalization code needed for an ABI wrapper.""" + return [] + + def return_code(self, name): + """Process a value and then build up a return statement.""" + return [f'return {name};'] + + @property + def argument(self): + """Return the argument text required for passing an argument to a function.""" + return self.name + + @abstractmethod + def type_text(self, count_type=None): + """Return the source text corresponding to a type definition.""" + + def tmp_type_text(self, count_type=None): + """Return source text corresponding to a temporary type definition before conversion.""" + return self.type_text(count_type=count_type) + + def parameter(self, count_type=None, **kwargs): + return f'{self.type_text(count_type)} {self.name}' + + +@Type.add_type('ERROR_CLASS') +class TypeErrorClass(Type): + + def type_text(self, count_type=None): + return 'int' + + def return_code(self, name): + return [f'return {ConvertFuncs.ERROR_CLASS}({name});'] + + +@Type.add_type('BUFFER') +class TypeBuffer(Type): + + def type_text(self, count_type=None): + return 'const void *' + + +@Type.add_type('BUFFER_OUT') +class TypeBufferOut(Type): + + def type_text(self, count_type=None): + return f'void *' + + +@Type.add_type('COUNT') +class TypeCount(Type): + + @property + def is_count(self): + return True + + def type_text(self, count_type=None): + return 'int' if count_type is None else count_type + + +@Type.add_type('INT') +class TypeBufferOut(Type): + + def type_text(self, count_type=None): + return 'int' + + +@Type.add_type('AINT') +class TypeBufferOut(Type): + + def type_text(self, count_type=None): + return 'MPI_Aint' + + +@Type.add_type('INT_OUT') +class TypeBufferOut(Type): + + def type_text(self, count_type=None): + return 'int *' + + def parameter(self, count_type=None, **kwargs): + if self.count_param is None: + return f'int *{self.name}' + else: + return f'int {self.name}[]' + + +@Type.add_type('DOUBLE') +class TypeDouble(Type): + + def type_text(self, count_type=None): + return 'double' + + +@Type.add_type('ARGV') +class TypeArgv(Type): + + def type_text(self, count_type=None): + return 'char ***' + + +@Type.add_type('DATATYPE', abi_type=['ompi']) +class TypeDatatype(Type): + + def type_text(self, count_type=None): + return 'MPI_Datatype' + + +class StandardABIType(Type): + + @property + def tmpname(self): + return f'{self.name}_tmp' + + @property + def argument(self): + return self.tmpname + + +@Type.add_type('DATATYPE', abi_type=['standard']) +class TypeDatatype(StandardABIType): + + @property + def init_code(self): + return [f'MPI_Datatype {self.tmpname} = {ConvertFuncs.DATATYPE}({self.name});'] + + def type_text(self, count_type=None): + return self.mangle_name('MPI_Datatype') + + +@Type.add_type('OP', abi_type=['ompi']) +class TypeDatatype(Type): + + def type_text(self, count_type=None): + return 'MPI_Op' + + +@Type.add_type('OP', abi_type=['standard']) +class TypeDatatype(StandardABIType): + + @property + def init_code(self): + return [f'MPI_Op {self.tmpname} = {ConvertFuncs.OP}({self.name});'] + + def type_text(self, count_type=None): + return self.mangle_name('MPI_Op') + + +@Type.add_type('RANK') +class TypeRank(Type): + + def type_text(self, count_type=None): + return 'int' + + +@Type.add_type('TAG') +class TypeRank(Type): + + def type_text(self, count_type=None): + return 'int' + + +@Type.add_type('COMM', abi_type=['ompi']) +class TypeCommunicator(Type): + + def type_text(self, count_type=None): + return 'MPI_Comm' + + +@Type.add_type('COMM', abi_type=['standard']) +class TypeCommunicatorStandard(StandardABIType): + + @property + def init_code(self): + return [f'MPI_Comm {self.tmpname} = {ConvertFuncs.COMM}({self.name});'] + + def tmp_type_text(self, count_type=None): + return 'MPI_Comm' + + def return_code(self, name): + return [f'return {ConvertOMPIToStandard.COMM}({name});'] + + def type_text(self, count_type=None): + return self.mangle_name('MPI_Comm') + + +@Type.add_type('COMM_OUT', abi_type=['ompi']) +class TypeCommunicator(Type): + + def type_text(self, count_type=None): + return 'MPI_Comm *' + + +@Type.add_type('COMM_OUT', abi_type=['standard']) +class TypeCommunicator(Type): + + @property + def final_code(self): + return [f'*{self.name} = {ConvertOMPIToStandard.COMM}((MPI_Comm) *{self.name});'] + + def type_text(self, count_type=None): + type_name = self.mangle_name('MPI_Comm') + return f'{type_name} *' + + @property + def argument(self): + return f'(MPI_Comm *) {self.name}' + + +@Type.add_type('WIN', abi_type=['ompi']) +class TypeWindow(Type): + + def type_text(self, count_type=None): + return 'MPI_Win' + + +@Type.add_type('WIN', abi_type=['standard']) +class TypeWindowStandard(StandardABIType): + + @property + def init_code(self): + return [f'MPI_Win {self.tmpname} = {ConvertFuncs.WIN}({self.name});'] + + def type_text(self, count_type=None): + return self.mangle_name('MPI_Win') + + +@Type.add_type('REQUEST', abi_type=['ompi']) +class TypeRequest(Type): + + def type_text(self, count_type=None): + return 'MPI_Request' + + +@Type.add_type('REQUEST', abi_type=['standard']) +class TypeRequestStandard(Type): + + def type_text(self, count_type=None): + return self.mangle_name('MPI_Request') + + @property + def argument(self): + return f'(MPI_Request) {self.name}' + + +@Type.add_type('REQUEST_INOUT', abi_type=['ompi']) +class TypeRequestInOut(Type): + + def type_text(self, count_type=None): + return 'MPI_Request *' + + +@Type.add_type('REQUEST_INOUT', abi_type=['standard']) +class TypeRequestInOutStandard(Type): + + @property + def final_code(self): + if self.count_param is None: + return [f'{ConvertFuncs.REQUEST}({self.name});'] + else: + return [ + 'for (int i = 0; i < %s; ++i) {' % (self.count_param,), + f'{ConvertFuncs.REQUEST}(&{self.name}[i]);', + '}', + ] + + @property + def argument(self): + return f'(MPI_Request *) {self.name}' + + def type_text(self, count_type=None): + type_name = self.mangle_name('MPI_Request') + return f'{type_name} *' + + def parameter(self, count_type=None, **kwargs): + type_name = self.mangle_name('MPI_Request') + if self.count_param is None: + return f'{type_name} *{self.name}' + else: + return f'{type_name} {self.name}[]' + + +@Type.add_type('STATUS_OUT', abi_type=['ompi']) +class TypeStatusOut(Type): + + def type_text(self, count_type=None): + return 'MPI_Status *' + + def parameter(self, count_type=None, **kwargs): + if self.count_param is None: + return f'MPI_Status *{self.name}' + else: + return f'MPI_Status {self.name}[]' + + +@Type.add_type('STATUS_OUT', abi_type=['standard']) +class TypeStausOutStandard(StandardABIType): + + def if_should_set_status(self): + """Generate the condition to check if the status(es) should be set.""" + condition = ' && '.join(f'{self.mangle_name(const)} != {self.name}' + for const in IGNORED_STATUS_HANDLES) + return 'if (%s) {' % (condition,) + + @property + def status_argument(self): + return f'{self.name}_arg' + + @property + def init_code(self): + code = [f'MPI_Status *{self.status_argument} = NULL;'] + if self.count_param is None: + code.append(f'MPI_Status {self.tmpname};') + else: + code.append(f'MPI_Status *{self.tmpname} = NULL;') + code.append(self.if_should_set_status()) + if self.count_param is not None: + code.append(f'{self.tmpname} = malloc({self.count_param} * sizeof(MPI_Status));') + code.append(f'{self.status_argument} = {self.tmpname};') + else: + code.append(f'{self.status_argument} = &{self.tmpname};') + code.append('} else {') + if self.count_param is not None: + code.append(f'{self.status_argument} = MPI_STATUSES_IGNORE;') + else: + code.append(f'{self.status_argument} = MPI_STATUS_IGNORE;') + code.append('}') + return code + + @property + def final_code(self): + code = [self.if_should_set_status()] + if self.count_param is None: + code.append(f'{ConvertFuncs.STATUS}({self.name}, &{self.tmpname});') + else: + code.extend([ + 'for (int i = 0; i < %s; ++i) {' % (self.count_param,), + f'{ConvertFuncs.STATUS}(&{self.name}[i], &{self.tmpname}[i]);', + '}', + f'free({self.tmpname});', + ]) + code.append('}') + return code + + @property + def argument(self): + return self.status_argument + + def type_text(self, count_type=None): + type_name = self.mangle_name('MPI_Status') + return f'{type_name} *' + + def parameter(self, count_type=None, **kwargs): + type_name = self.mangle_name('MPI_Status') + if self.count_param is None: + return f'{type_name} *{self.name}' + else: + return f'{type_name} {self.name}[]' + + +# For now this just assumes that MPI_Fint doesn't need any conversions +@Type.add_type('FINT') +class TypeFint(Type): + + def type_text(self, count_type=None): + return 'MPI_Fint' + + +@Type.add_type('STRING') +class TypeString(Type): + + def type_text(self, count_type=None): + return 'const char *' + + +@Type.add_type('STRING_OUT') +class TypeStringOut(Type): + + def type_text(self, count_type=None): + return 'char *' + + +@Type.add_type('INFO', abi_type=['ompi']) +class TypeInfo(Type): + + def type_text(self, count_type=None): + return 'MPI_Info' + + +@Type.add_type('INFO', abi_type=['standard']) +class TypeInfoStandard(StandardABIType): + + @property + def init_code(self): + return [f'MPI_Info {self.tmpname} = {ConvertFuncs.INFO}({self.name});'] + + def type_text(self, count_type=None): + return self.mangle_name('MPI_Info') + + +@Type.add_type('FILE_OUT', abi_type=['ompi']) +class TypeFileOut(Type): + + def type_text(self, count_type=None): + return 'MPI_File *' + + +@Type.add_type('FILE_OUT', abi_type=['standard']) +class TypeFileOutStandard(Type): + + @property + def argument(self): + return f'(MPI_File *) {self.name}' + + @property + def final_code(self): + return [f'{ConvertFuncs.FILE}({self.name});'] + + def type_text(self, count_type=None): + type_name = self.mangle_name('MPI_File') + return f'{type_name} *' + + +class Prototype: + """MPI function prototype.""" + + def __init__(self, name, return_type, params): + self.name = name + self.return_type = return_type + self.params = params + + def signature(self, abi_type, fn_name, count_type=None, **kwargs): + """Build a signature with the given name and count_type.""" + params = ', '.join(param.construct(abi_type, **kwargs).parameter(count_type=count_type, **kwargs) + for param in self.params) + if not params: + params = 'void' + return_type_text = self.return_type.construct(abi_type, **kwargs).type_text(count_type=count_type) + return f'{return_type_text} {fn_name}({params})' + + @property + def need_bigcount(self): + """Check if a bigcount interface is required for a prototype.""" + return any('COUNT' in param.type_ for param in self.params) + + +class TemplateParseError(Exception): + """Error raised during parsing.""" + pass + + +def validate_body(body): + """Validate the body of a template.""" + # Just do a simple bracket balance test to determine the bounds of the + # function body. All lines after the function body should be blank. There + # are cases where this will break, such as if someone puts code all on one + # line. + bracket_balance = 0 + line_count = 0 + for line in body: + line = line.strip() + if bracket_balance == 0 and line_count > 0 and line: + raise TemplateParseError('Extra code found in template; only one function body is allowed') + + update = line.count('{') - line.count('}') + bracket_balance += update + if bracket_balance != 0: + line_count += 1 + + if bracket_balance != 0: + raise TemplateParseError('Mismatched brackets found in template') + + +class SourceTemplate: + """Source template for a single API function.""" + + def __init__(self, prototype, header, body): + self.prototype = prototype + self.header = header + self.body = body + + @staticmethod + def load(fname, prefix=None): + """Load a template file and return the SourceTemplate.""" + if prefix is not None: + fname = os.path.join(prefix, fname) + with open(fname) as fp: + header = [] + prototype = [] + body = [] + + for line in fp: + line = line.rstrip() + if prototype and line.startswith('PROTOTYPE'): + raise TemplateParseError('more than one prototype found in template file') + elif ((prototype and not any(')' in s for s in prototype)) + or line.startswith('PROTOTYPE')): + prototype.append(line) + elif prototype: + # Validate bracket balance + body.append(line) + else: + header.append(line) + + if not prototype: + raise RuntimeError('missing prototype') + # Parse the prototype + prototype = ''.join(prototype) + prototype = prototype[len('PROTOTYPE'):] + i = prototype.index('(') + j = prototype.index(')') + return_type, name = prototype[:i].split() + return_type = ReturnType(return_type) + params = [param.strip() for param in prototype[i + 1:j].split(',') if param.strip()] + params = [Parameter(param) for param in params] + prototype = Prototype(name, return_type, params) + # Ensure the body contains only one function + validate_body(body) + return SourceTemplate(prototype, header, body) + + def print_header(self, file=sys.stdout): + """Print the source header.""" + for line in self.header: + print(line, file=file) + + def print_body(self, func_name, file=sys.stdout): + """Print the body.""" + for line in self.body: + # FUNC_NAME is used for error messages + line = line.replace('FUNC_NAME', f'"{func_name}"') + print(line, file=file) + + +def print_profiling_header(fn_name, file=sys.stdout): + """Print the profiling header code.""" + print('#if OMPI_BUILD_MPI_PROFILING') + print('#if OPAL_HAVE_WEAK_SYMBOLS', file=file) + print(f'#pragma weak {fn_name} = P{fn_name}', file=file) + print('#endif', file=file) + print(f'#define {fn_name} P{fn_name}', file=file) + print('#endif') + + +def ompi_abi(base_name, template): + """Generate the OMPI ABI functions.""" + template.print_header() + print_profiling_header(base_name) + print(template.prototype.signature('ompi', base_name)) + template.print_body(func_name=base_name) + # Check if we need to generate the bigcount interface + if template.prototype.need_bigcount: + base_name_c = f'{base_name}_c' + print_profiling_header(base_name_c) + print(template.prototype.signature('ompi', base_name_c, count_type='MPI_Count')) + template.print_body(func_name=base_name_c) + + +ABI_INTERNAL_HEADER = 'ompi/mpi/c/abi.h' + + +def indent_lines(lines, tab, start=0): + """Crude pretty-printing function.""" + new_lines = [] + indent_count = start + for line in lines: + # Closing bracket + if '}' in line: + indent_count -= 1 + + prefix = indent_count * tab + new_lines.append(f'{prefix}{line}') + + # Opening bracket + if '{' in line: + indent_count += 1 + return new_lines + + +def standard_abi(base_name, template): + """Generate the standard ABI functions.""" + template.print_header() + print(f'#include "{ABI_INTERNAL_HEADER}"') + + # Static internal function (add a random component to avoid conflicts) + internal_name = f'ompi_abi_{template.prototype.name}' + internal_sig = template.prototype.signature('ompi', internal_name, + count_type='MPI_Count') + print(INLINE_ATTRS, internal_sig) + template.print_body(func_name=base_name) + + def generate_function(prototype, fn_name, internal_fn, count_type='int'): + """Generate a function for the standard ABI.""" + print_profiling_header(fn_name) + + # Handle type conversions and arguments + params = [param.construct('standard') for param in prototype.params] + print(prototype.signature('standard', fn_name, count_type=count_type)) + print('{') + lines = [] + return_type = prototype.return_type.construct('standard') + lines.append(f'{return_type.tmp_type_text()} ret_value;') + for param in params: + if param.init_code: + lines.extend(param.init_code) + pass_args = ', '.join(param.argument for param in params) + lines.append(f'ret_value = {internal_fn}({pass_args});') + for param in params: + if param.final_code: + lines.extend(param.final_code) + lines.extend(return_type.return_code('ret_value')) + + # Indent the lines + lines = indent_lines(lines, 4 * ' ', start=1) + for line in lines: + print(line) + print('}') + + generate_function(template.prototype, base_name, internal_name) + if template.prototype.need_bigcount: + base_name_c = f'{base_name}_c' + generate_function(template.prototype, base_name_c, internal_name, + count_type='MPI_Count') + + +def gen_header(args): + """Generate an ABI header and conversion code.""" + prototypes = [SourceTemplate.load(file_, args.srcdir).prototype for file_ in args.file] + + builder = ABIHeaderBuilder(prototypes, external=args.external) + builder.dump_header() + + +def gen_source(args): + """Generate source file.""" + template = SourceTemplate.load(args.source_file) + + base_name = mpi_fn_name_from_base_fn_name(template.prototype.name) + if args.type == 'ompi': + ompi_abi(base_name, template) + else: + standard_abi(base_name, template) + + +def main(): + if len(sys.argv) < 2: + # Fix required for Python 3.6 + print('ERROR: missing subparser argument (see --help)') + sys.exit(1) + + parser = argparse.ArgumentParser(description='generate ABI header file and conversion code') + subparsers = parser.add_subparsers() + + parser_header = subparsers.add_parser('header') + parser_header.add_argument('file', nargs='+', help='list of template source files') + parser_header.add_argument('--external', action='store_true', help='generate external mpi.h header file') + parser_header.add_argument('--srcdir', help='source directory') + parser_header.set_defaults(func=gen_header) + + parser_gen = subparsers.add_parser('source') + # parser = argparse.ArgumentParser(description='C ABI binding generation code') + parser_gen.add_argument('type', choices=('ompi', 'standard'), + help='generate the OMPI ABI functions or the standard ABI functions') + parser_gen.add_argument('source_file', help='source template file') + parser_gen.set_defaults(func=gen_source) + + args = parser.parse_args() + + # Always add the header + print('/* THIS FILE WAS AUTOGENERATED BY ompi/mpi/c/abi.py. DO NOT EDIT BY HAND. */') + args.func(args) + + +if __name__ == '__main__': + main() 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/abort.c b/ompi/mpi/c/abort.c.in similarity index 88% rename from ompi/mpi/c/abort.c rename to ompi/mpi/c/abort.c.in index 889fe1738b3..af43118d331 100644 --- a/ompi/mpi/c/abort.c +++ b/ompi/mpi/c/abort.c.in @@ -28,17 +28,7 @@ #include "ompi/memchecker.h" #include "ompi/communicator/communicator.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Abort = PMPI_Abort -#endif -#define MPI_Abort PMPI_Abort -#endif - -static const char FUNC_NAME[] = "MPI_Abort"; - - -int MPI_Abort(MPI_Comm comm, int errorcode) +PROTOTYPE ERROR_CLASS abort(COMM comm, INT errorcode) { MEMCHECKER( memchecker_comm(comm); diff --git a/ompi/mpi/c/accumulate.c b/ompi/mpi/c/accumulate.c.in similarity index 92% rename from ompi/mpi/c/accumulate.c rename to ompi/mpi/c/accumulate.c.in index a1e6bf91365..7a6b39bafd6 100644 --- a/ompi/mpi/c/accumulate.c +++ b/ompi/mpi/c/accumulate.c.in @@ -34,18 +34,9 @@ #include "ompi/datatype/ompi_datatype_internal.h" #include "ompi/memchecker.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Accumulate = PMPI_Accumulate -#endif -#define MPI_Accumulate PMPI_Accumulate -#endif - -static const char FUNC_NAME[] = "MPI_Accumulate"; - -int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, - int target_rank, MPI_Aint target_disp, int target_count, - MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) +PROTOTYPE ERROR_CLASS accumulate(BUFFER origin_addr, COUNT origin_count, DATATYPE origin_datatype, + INT target_rank, AINT target_disp, COUNT target_count, + DATATYPE target_datatype, OP op, WIN win) { int rc; ompi_win_t *ompi_win = (ompi_win_t*) win; diff --git a/ompi/mpi/c/allreduce.c b/ompi/mpi/c/allreduce.c.in similarity index 92% rename from ompi/mpi/c/allreduce.c rename to ompi/mpi/c/allreduce.c.in index 9f2c5023cac..7d4e278bfdf 100644 --- a/ompi/mpi/c/allreduce.c +++ b/ompi/mpi/c/allreduce.c.in @@ -34,18 +34,8 @@ #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Allreduce = PMPI_Allreduce -#endif -#define MPI_Allreduce PMPI_Allreduce -#endif - -static const char FUNC_NAME[] = "MPI_Allreduce"; - - -int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, - MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) +PROTOTYPE ERROR_CLASS allreduce(BUFFER sendbuf, BUFFER_OUT recvbuf, COUNT count, + DATATYPE datatype, OP op, COMM comm) { int err; diff --git a/ompi/mpi/c/barrier.c b/ompi/mpi/c/barrier.c.in similarity index 91% rename from ompi/mpi/c/barrier.c rename to ompi/mpi/c/barrier.c.in index 35e629b0524..005abe6f4e0 100644 --- a/ompi/mpi/c/barrier.c +++ b/ompi/mpi/c/barrier.c.in @@ -28,17 +28,7 @@ #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Barrier = PMPI_Barrier -#endif -#define MPI_Barrier PMPI_Barrier -#endif - -static const char FUNC_NAME[] = "MPI_Barrier"; - - -int MPI_Barrier(MPI_Comm comm) +PROTOTYPE ERROR_CLASS barrier(COMM comm) { int err = MPI_SUCCESS; diff --git a/ompi/mpi/c/comm_f2c.c b/ompi/mpi/c/comm_f2c.c.in similarity index 88% rename from ompi/mpi/c/comm_f2c.c rename to ompi/mpi/c/comm_f2c.c.in index a0bd6be2acb..0df53a1e2de 100644 --- a/ompi/mpi/c/comm_f2c.c +++ b/ompi/mpi/c/comm_f2c.c.in @@ -28,17 +28,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_Comm_f2c = PMPI_Comm_f2c -#endif -#define MPI_Comm_f2c PMPI_Comm_f2c -#endif - -static const char FUNC_NAME[] = "MPI_Comm_f2c"; - - -MPI_Comm MPI_Comm_f2c(MPI_Fint comm) +PROTOTYPE COMM comm_f2c(FINT comm) { int o_index= OMPI_FINT_2_INT(comm); diff --git a/ompi/mpi/c/comm_free.c b/ompi/mpi/c/comm_free.c.in similarity index 88% rename from ompi/mpi/c/comm_free.c rename to ompi/mpi/c/comm_free.c.in index f190011aabd..640865ade41 100644 --- a/ompi/mpi/c/comm_free.c +++ b/ompi/mpi/c/comm_free.c.in @@ -26,17 +26,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Comm_free = PMPI_Comm_free -#endif -#define MPI_Comm_free PMPI_Comm_free -#endif - -static const char FUNC_NAME[] = "MPI_Comm_free"; - - -int MPI_Comm_free(MPI_Comm *comm) +PROTOTYPE ERROR_CLASS comm_free(COMM_OUT comm) { int ret; diff --git a/ompi/mpi/c/comm_rank.c b/ompi/mpi/c/comm_rank.c.in similarity index 87% rename from ompi/mpi/c/comm_rank.c rename to ompi/mpi/c/comm_rank.c.in index 8709d71f34d..5959e19422b 100644 --- a/ompi/mpi/c/comm_rank.c +++ b/ompi/mpi/c/comm_rank.c.in @@ -27,17 +27,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Comm_rank = PMPI_Comm_rank -#endif -#define MPI_Comm_rank PMPI_Comm_rank -#endif - -static const char FUNC_NAME[] = "MPI_Comm_rank"; - - -int MPI_Comm_rank(MPI_Comm comm, int *rank) +PROTOTYPE ERROR_CLASS comm_rank(COMM comm, INT_OUT rank) { MEMCHECKER( memchecker_comm(comm); diff --git a/ompi/mpi/c/comm_size.c b/ompi/mpi/c/comm_size.c.in similarity index 87% rename from ompi/mpi/c/comm_size.c rename to ompi/mpi/c/comm_size.c.in index 2c9f0232f48..b3aefff6f74 100644 --- a/ompi/mpi/c/comm_size.c +++ b/ompi/mpi/c/comm_size.c.in @@ -29,17 +29,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Comm_size = PMPI_Comm_size -#endif -#define MPI_Comm_size PMPI_Comm_size -#endif - -static const char FUNC_NAME[] = "MPI_Comm_size"; - - -int MPI_Comm_size(MPI_Comm comm, int *size) +PROTOTYPE ERROR_CLASS comm_size(COMM comm, INT_OUT size) { MEMCHECKER( memchecker_comm(comm); diff --git a/ompi/mpi/c/comm_split.c b/ompi/mpi/c/comm_split.c.in similarity index 89% rename from ompi/mpi/c/comm_split.c rename to ompi/mpi/c/comm_split.c.in index a55f0fa7204..0e25e798a19 100644 --- a/ompi/mpi/c/comm_split.c +++ b/ompi/mpi/c/comm_split.c.in @@ -28,18 +28,8 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Comm_split = PMPI_Comm_split -#endif -#define MPI_Comm_split PMPI_Comm_split -#endif - -static const char FUNC_NAME[] = "MPI_Comm_split"; - - -int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm) { - +PROTOTYPE ERROR_CLASS comm_split(COMM comm, INT color, INT key, COMM_OUT newcomm) +{ int rc; MEMCHECKER( diff --git a/ompi/mpi/c/comm_split_type.c b/ompi/mpi/c/comm_split_type.c.in similarity index 92% rename from ompi/mpi/c/comm_split_type.c rename to ompi/mpi/c/comm_split_type.c.in index 3af3087eded..be277b35af9 100644 --- a/ompi/mpi/c/comm_split_type.c +++ b/ompi/mpi/c/comm_split_type.c.in @@ -32,19 +32,9 @@ #include "ompi/info/info.h" #include "ompi/memchecker.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Comm_split_type = PMPI_Comm_split_type -#endif -#define MPI_Comm_split_type PMPI_Comm_split_type -#endif - -static const char FUNC_NAME[] = "MPI_Comm_split_type"; - - -int MPI_Comm_split_type(MPI_Comm comm, int split_type, int key, - MPI_Info info, MPI_Comm *newcomm) { - +PROTOTYPE ERROR_CLASS comm_split_type(COMM comm, INT split_type, INT key, + INFO info, COMM_OUT newcomm) +{ int rc; MEMCHECKER( diff --git a/ompi/mpi/c/file_open.c b/ompi/mpi/c/file_open.c.in similarity index 92% rename from ompi/mpi/c/file_open.c rename to ompi/mpi/c/file_open.c.in index 204e92e9e44..0303ef4f970 100644 --- a/ompi/mpi/c/file_open.c +++ b/ompi/mpi/c/file_open.c.in @@ -39,18 +39,8 @@ extern opal_mutex_t ompi_mpi_file_bootstrap_mutex; -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_File_open = PMPI_File_open -#endif -#define MPI_File_open PMPI_File_open -#endif - -static const char FUNC_NAME[] = "MPI_File_open"; - - -int MPI_File_open(MPI_Comm comm, const char *filename, int amode, - MPI_Info info, MPI_File *fh) +PROTOTYPE ERROR_CLASS file_open(COMM comm, STRING filename, INT amode, + INFO info, FILE_OUT fh) { int rc; diff --git a/ompi/mpi/c/finalize.c b/ompi/mpi/c/finalize.c.in similarity index 86% rename from ompi/mpi/c/finalize.c rename to ompi/mpi/c/finalize.c.in index be7989261ba..a50fef2c5b0 100644 --- a/ompi/mpi/c/finalize.c +++ b/ompi/mpi/c/finalize.c.in @@ -25,17 +25,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Finalize = PMPI_Finalize -#endif -#define MPI_Finalize PMPI_Finalize -#endif - -static const char FUNC_NAME[] = "MPI_Finalize"; - - -int MPI_Finalize(void) +PROTOTYPE ERROR_CLASS finalize() { /* If --with-spc and ompi_mpi_spc_dump_enabled were specified, print * all of the final SPC values aggregated across the whole MPI run. diff --git a/ompi/mpi/c/finalized.c b/ompi/mpi/c/finalized.c.in similarity index 90% rename from ompi/mpi/c/finalized.c rename to ompi/mpi/c/finalized.c.in index 514e91b3b25..1a2934db784 100644 --- a/ompi/mpi/c/finalized.c +++ b/ompi/mpi/c/finalized.c.in @@ -28,17 +28,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/mca/hook/base/base.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Finalized = PMPI_Finalized -#endif -#define MPI_Finalized PMPI_Finalized -#endif - -static const char FUNC_NAME[] = "MPI_Finalized"; - - -int MPI_Finalized(int *flag) +PROTOTYPE ERROR_CLASS finalized(INT_OUT flag) { ompi_hook_base_mpi_finalized_top(flag); diff --git a/ompi/mpi/c/get_library_version.c b/ompi/mpi/c/get_library_version.c.in similarity index 93% rename from ompi/mpi/c/get_library_version.c rename to ompi/mpi/c/get_library_version.c.in index cb82d91c108..52da2059e39 100644 --- a/ompi/mpi/c/get_library_version.c +++ b/ompi/mpi/c/get_library_version.c.in @@ -27,17 +27,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Get_library_version = PMPI_Get_library_version -#endif -#define MPI_Get_library_version PMPI_Get_library_version -#endif - -static const char FUNC_NAME[] = "MPI_Get_library_version"; - - -int MPI_Get_library_version(char *version, int *resultlen) +PROTOTYPE ERROR_CLASS get_library_version(STRING_OUT version, INT_OUT resultlen) { int len_left; char *ptr, tmp[MPI_MAX_LIBRARY_VERSION_STRING]; diff --git a/ompi/mpi/c/get_processor_name.c b/ompi/mpi/c/get_processor_name.c.in similarity index 87% rename from ompi/mpi/c/get_processor_name.c rename to ompi/mpi/c/get_processor_name.c.in index c76fd6dcdd3..d705c4d25a3 100644 --- a/ompi/mpi/c/get_processor_name.c +++ b/ompi/mpi/c/get_processor_name.c.in @@ -30,17 +30,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Get_processor_name = PMPI_Get_processor_name -#endif -#define MPI_Get_processor_name PMPI_Get_processor_name -#endif - -static const char FUNC_NAME[] = "MPI_Get_processor_name"; - - -int MPI_Get_processor_name(char *name, int *resultlen) +PROTOTYPE ERROR_CLASS get_processor_name(STRING_OUT name, INT_OUT resultlen) { if ( MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); diff --git a/ompi/mpi/c/init.c b/ompi/mpi/c/init.c.in similarity index 92% rename from ompi/mpi/c/init.c rename to ompi/mpi/c/init.c.in index eb5a50a7643..65a493e85a4 100644 --- a/ompi/mpi/c/init.c +++ b/ompi/mpi/c/init.c.in @@ -31,17 +31,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/constants.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Init = PMPI_Init -#endif -#define MPI_Init PMPI_Init -#endif - -static const char FUNC_NAME[] = "MPI_Init"; - - -int MPI_Init(int *argc, char ***argv) +PROTOTYPE INT init(INT_OUT argc, ARGV argv) { int err; int provided; diff --git a/ompi/mpi/c/initialized.c b/ompi/mpi/c/initialized.c.in similarity index 90% rename from ompi/mpi/c/initialized.c rename to ompi/mpi/c/initialized.c.in index 57f4e466243..e05e6ba2b4e 100644 --- a/ompi/mpi/c/initialized.c +++ b/ompi/mpi/c/initialized.c.in @@ -28,17 +28,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/mca/hook/base/base.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Initialized = PMPI_Initialized -#endif -#define MPI_Initialized PMPI_Initialized -#endif - -static const char FUNC_NAME[] = "MPI_Initialized"; - - -int MPI_Initialized(int *flag) +PROTOTYPE ERROR_CLASS initialized(INT_OUT flag) { ompi_hook_base_mpi_initialized_top(flag); diff --git a/ompi/mpi/c/irecv.c b/ompi/mpi/c/irecv.c.in similarity index 89% rename from ompi/mpi/c/irecv.c rename to ompi/mpi/c/irecv.c.in index 7173282de18..1668e7aa7d4 100644 --- a/ompi/mpi/c/irecv.c +++ b/ompi/mpi/c/irecv.c.in @@ -30,18 +30,8 @@ #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Irecv = PMPI_Irecv -#endif -#define MPI_Irecv PMPI_Irecv -#endif - -static const char FUNC_NAME[] = "MPI_Irecv"; - - -int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source, - int tag, MPI_Comm comm, MPI_Request *request) +PROTOTYPE ERROR_CLASS irecv(BUFFER_OUT buf, COUNT count, DATATYPE type, + INT source, INT tag, COMM comm, REQUEST_INOUT request) { int rc = MPI_SUCCESS; diff --git a/ompi/mpi/c/isend.c b/ompi/mpi/c/isend.c.in similarity index 91% rename from ompi/mpi/c/isend.c rename to ompi/mpi/c/isend.c.in index 5cbcd36d0d7..595929ece2f 100644 --- a/ompi/mpi/c/isend.c +++ b/ompi/mpi/c/isend.c.in @@ -34,18 +34,8 @@ #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Isend = PMPI_Isend -#endif -#define MPI_Isend PMPI_Isend -#endif - -static const char FUNC_NAME[] = "MPI_Isend"; - - -int MPI_Isend(const void *buf, int count, MPI_Datatype type, int dest, - int tag, MPI_Comm comm, MPI_Request *request) +PROTOTYPE ERROR_CLASS isend(BUFFER buf, COUNT count, DATATYPE type, INT dest, + INT tag, COMM comm, REQUEST_INOUT request) { int rc = MPI_SUCCESS; diff --git a/ompi/mpi/c/recv.c b/ompi/mpi/c/recv.c.in similarity index 91% rename from ompi/mpi/c/recv.c rename to ompi/mpi/c/recv.c.in index 56e501034e8..1fc672100ec 100644 --- a/ompi/mpi/c/recv.c +++ b/ompi/mpi/c/recv.c.in @@ -30,18 +30,8 @@ #include "ompi/request/request.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Recv = PMPI_Recv -#endif -#define MPI_Recv PMPI_Recv -#endif - -static const char FUNC_NAME[] = "MPI_Recv"; - - -int MPI_Recv(void *buf, int count, MPI_Datatype type, int source, - int tag, MPI_Comm comm, MPI_Status *status) +PROTOTYPE ERROR_CLASS recv(BUFFER_OUT buf, COUNT count, DATATYPE type, + INT source, INT tag, COMM comm, STATUS_OUT status) { int rc = MPI_SUCCESS; diff --git a/ompi/mpi/c/send.c b/ompi/mpi/c/send.c.in similarity index 91% rename from ompi/mpi/c/send.c rename to ompi/mpi/c/send.c.in index b21bba2c7bc..4b71b0bacf4 100644 --- a/ompi/mpi/c/send.c +++ b/ompi/mpi/c/send.c.in @@ -33,18 +33,8 @@ #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Send = PMPI_Send -#endif -#define MPI_Send PMPI_Send -#endif - -static const char FUNC_NAME[] = "MPI_Send"; - - -int MPI_Send(const void *buf, int count, MPI_Datatype type, int dest, - int tag, MPI_Comm comm) +PROTOTYPE ERROR_CLASS send(BUFFER buf, COUNT count, DATATYPE type, RANK dest, + TAG tag, COMM comm) { int rc = MPI_SUCCESS; diff --git a/ompi/mpi/c/status_c2f.c b/ompi/mpi/c/status_c2f.c index dd0190cae66..24cf45e6dca 100644 --- a/ompi/mpi/c/status_c2f.c +++ b/ompi/mpi/c/status_c2f.c @@ -31,6 +31,7 @@ #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" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -44,8 +45,6 @@ static const char FUNC_NAME[] = "MPI_Status_c2f"; int MPI_Status_c2f(const MPI_Status *c_status, MPI_Fint *f_status) { - const int *c_ints; - int i; MEMCHECKER( if(c_status != MPI_STATUSES_IGNORE) { /* @@ -69,33 +68,5 @@ int MPI_Status_c2f(const MPI_Status *c_status, MPI_Fint *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 b/ompi/mpi/c/status_f2c.c index 32fa39b86e9..78c142fac26 100644 --- a/ompi/mpi/c/status_f2c.c +++ b/ompi/mpi/c/status_f2c.c @@ -29,6 +29,7 @@ #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" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -42,8 +43,6 @@ static const char FUNC_NAME[] = "MPI_Status_f2c"; int MPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status) { - int i, *c_ints; - if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); @@ -65,17 +64,5 @@ int MPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *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/waitall.c b/ompi/mpi/c/waitall.c.in similarity index 92% rename from ompi/mpi/c/waitall.c rename to ompi/mpi/c/waitall.c.in index 14485de4e70..bedb80d9240 100644 --- a/ompi/mpi/c/waitall.c +++ b/ompi/mpi/c/waitall.c.in @@ -33,17 +33,8 @@ #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Waitall = PMPI_Waitall -#endif -#define MPI_Waitall PMPI_Waitall -#endif - -static const char FUNC_NAME[] = "MPI_Waitall"; - - -int MPI_Waitall(int count, MPI_Request requests[], MPI_Status statuses[]) +PROTOTYPE ERROR_CLASS waitall(INT count, REQUEST_INOUT requests:count, + STATUS_OUT statuses:count) { SPC_RECORD(OMPI_SPC_WAITALL, 1); diff --git a/ompi/mpi/c/waitsome.c b/ompi/mpi/c/waitsome.c.in similarity index 91% rename from ompi/mpi/c/waitsome.c rename to ompi/mpi/c/waitsome.c.in index 169c7e10ec4..4828ba4999b 100644 --- a/ompi/mpi/c/waitsome.c +++ b/ompi/mpi/c/waitsome.c.in @@ -34,19 +34,9 @@ #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" -#if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Waitsome = PMPI_Waitsome -#endif -#define MPI_Waitsome PMPI_Waitsome -#endif - -static const char FUNC_NAME[] = "MPI_Waitsome"; - - -int MPI_Waitsome(int incount, MPI_Request requests[], - int *outcount, int indices[], - MPI_Status statuses[]) +PROTOTYPE ERROR_CLASS waitsome(INT incount, REQUEST_INOUT requests:incount, + INT_OUT outcount, INT_OUT indices:incount, + STATUS_OUT statuses:incount) { SPC_RECORD(OMPI_SPC_WAITSOME, 1); diff --git a/ompi/mpi/c/wtime.c b/ompi/mpi/c/wtime.c.in similarity index 93% rename from ompi/mpi/c/wtime.c rename to ompi/mpi/c/wtime.c.in index b7918ad5d0d..3c2f88cbdfb 100644 --- a/ompi/mpi/c/wtime.c +++ b/ompi/mpi/c/wtime.c.in @@ -38,21 +38,18 @@ #include "opal/util/clock_gettime.h" #if OMPI_BUILD_MPI_PROFILING -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_Wtime = PMPI_Wtime -#endif -#define MPI_Wtime PMPI_Wtime /** * Have a base time set on the first call to wtime, to improve the range * and accuracy of the user visible timer. * More info: https://github.com/mpi-forum/mpi-issues/issues/77#issuecomment-369663119 */ struct timespec ompi_wtime_time_origin = {.tv_sec = 0}; -#else /* OMPI_BUILD_MPI_PROFILING */ +#else extern struct timespec ompi_wtime_time_origin; #endif -double MPI_Wtime(void) + +PROTOTYPE DOUBLE wtime() { double wtime; 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/patterns/comm/Makefile.am b/ompi/patterns/comm/Makefile.am index 9a733aff78a..478ed1bbcec 100644 --- a/ompi/patterns/comm/Makefile.am +++ b/ompi/patterns/comm/Makefile.am @@ -11,7 +11,7 @@ headers += \ patterns/comm/coll_ops.h \ patterns/comm/commpatterns.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ patterns/comm/allreduce.c \ patterns/comm/allgather.c \ patterns/comm/bcast.c diff --git a/ompi/patterns/net/Makefile.am b/ompi/patterns/net/Makefile.am index d9b07fd1422..fae52aec51a 100644 --- a/ompi/patterns/net/Makefile.am +++ b/ompi/patterns/net/Makefile.am @@ -12,7 +12,7 @@ headers += \ patterns/net/netpatterns_knomial_tree.h \ patterns/net/coll_ops.h -lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ +libopen_mpi_la_SOURCES += \ patterns/net/netpatterns_base.c \ patterns/net/netpatterns_multinomial_tree.c \ patterns/net/netpatterns_nary_tree.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 01daa28ea0a..6483755c5f0 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" /* @@ -236,9 +237,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 2a31779b9fd..1ac36af3116 100644 --- a/ompi/runtime/Makefile.am +++ b/ompi/runtime/Makefile.am @@ -30,7 +30,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 0c785631804..8e56076296e 100644 --- a/ompi/tools/wrappers/Makefile.am +++ b/ompi/tools/wrappers/Makefile.am @@ -85,7 +85,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 @@ -98,6 +98,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 45f01c77069..3357bf8ce91 100644 --- a/ompi/util/Makefile.am +++ b/ompi/util/Makefile.am @@ -10,4 +10,5 @@ # Source code files headers += \ - util/timings.h + util/timings.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