From a7dcfd98742d7f44d96d74a60a38529894d4099c Mon Sep 17 00:00:00 2001 From: William Zhang Date: Tue, 28 Jul 2020 09:24:36 -0700 Subject: [PATCH 01/31] btl/ofi: Disable EFA provider in versions earlier than libfabric 1.12.0 EFA incorrectly implements FI_DELIVERY_COMPLETE in earlier libfabric versions. While FI_DELIVERY_COMPLETE would be advertised by the provider, completions would return too early by not accounting for bounce buffers on the receive side. This would cause the BTL to receive early completions that lead to correctness issues. This is not an issue in the mtl/ofi as it does not require FI_DELIVERY_COMPLETE. Signed-off-by: William Zhang --- opal/mca/btl/ofi/btl_ofi_component.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index c4efa5e167e..ee5809f17ab 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -59,6 +59,17 @@ static int validate_info(struct fi_info *info, uint64_t required_caps) BTL_VERBOSE(("validating device: %s", info->domain_attr->name)); + /* EFA does not fulfill FI_DELIVERY_COMPLETE requirements in prior libfabric + * versions. The prov version is set as: + * FI_VERSION(FI_MAJOR_VERSION * 100 + FI_MINOR_VERSION, FI_REVISION_VERSION * 10) + * Thus, FI_VERSION(112,0) corresponds to libfabric 1.12.0 + */ + if (!strncasecmp(info->fabric_attr->prov_name, "efa", 3) + && FI_VERSION_LT(info->fabric_attr->prov_version, FI_VERSION(112,0))) { + BTL_VERBOSE(("unsupported libfabric efa version")); + return OPAL_ERROR; + } + /* we need exactly all the required bits */ if ((info->caps & required_caps) != required_caps) { BTL_VERBOSE(("unsupported caps")); From 41acfee2bbfc5495aeeeae4b72f385ca8d1d8cee Mon Sep 17 00:00:00 2001 From: William Zhang Date: Tue, 11 Aug 2020 13:59:26 -0700 Subject: [PATCH 02/31] btl/ofi: Disable ofi_rxm provider The ofi_rxm provider is dependent upon the underlying hardware for its implementation of FI_DELIVERY_COMPLETE. Since this can lead to early completions, we disable the provider to avoid correctness issues. This is not an issue in the mtl/ofi as it does not require FI_DELIVERY_COMPLETE. Signed-off-by: William Zhang --- opal/mca/btl/ofi/btl_ofi_component.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index ee5809f17ab..37263b35cb3 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -70,6 +70,14 @@ static int validate_info(struct fi_info *info, uint64_t required_caps) return OPAL_ERROR; } + /* ofi_rxm does not fulfill FI_DELIVERY_COMPLETE requirements. Thus we + * exclude it if it's detected. + */ + if (strstr(info->fabric_attr->prov_name, "ofi_rxm")) { + BTL_VERBOSE(("ofi_rxm does not support FI_DELIVERY_COMPLETE")); + return OPAL_ERROR; + } + /* we need exactly all the required bits */ if ((info->caps & required_caps) != required_caps) { BTL_VERBOSE(("unsupported caps")); From 1e1193366059df8335b3a5bb475f00b81bb24609 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 17 Aug 2020 12:48:31 -0400 Subject: [PATCH 03/31] ompi: cleanup C++ MPI::ERRORS_THROW_EXCEPTIONS The C++ bindings were removed a while ago; MPI::ERRORS_THROW_EXCEPTIONS and MPI_ERRORS_THROW_EXCEPTIONS no longer exist. Signed-off-by: Jeff Squyres --- ompi/debuggers/ompi_mpihandles_dll.c | 2 -- ompi/errhandler/errhandler.c | 24 ------------------------ ompi/errhandler/errhandler.h | 6 ------ 3 files changed, 32 deletions(-) diff --git a/ompi/debuggers/ompi_mpihandles_dll.c b/ompi/debuggers/ompi_mpihandles_dll.c index ff6a65e4cf2..c0aef28c657 100644 --- a/ompi/debuggers/ompi_mpihandles_dll.c +++ b/ompi/debuggers/ompi_mpihandles_dll.c @@ -390,8 +390,6 @@ int mpidbg_init_per_process(mqs_process *process, &mpidbg_errhandler_name_map[i++]); fill_map(image, "MPI_ERRHANDLER_NULL", "ompi_mpi_errhandler_null", &mpidbg_errhandler_name_map[i++]); - /* MPI::ERRORS_THROW_EXCEPTIONS exists as a symbol in OMPI; no - need to alias it here */ /* Sentinel value */ mpidbg_errhandler_name_map[i].map_name = NULL; diff --git a/ompi/errhandler/errhandler.c b/ompi/errhandler/errhandler.c index a8598940d9f..53075032fec 100644 --- a/ompi/errhandler/errhandler.c +++ b/ompi/errhandler/errhandler.c @@ -74,9 +74,6 @@ ompi_predefined_errhandler_t *ompi_mpi_errors_abort_addr = ompi_predefined_errhandler_t ompi_mpi_errors_return = {{{0}}}; ompi_predefined_errhandler_t *ompi_mpi_errors_return_addr = &ompi_mpi_errors_return; -ompi_predefined_errhandler_t ompi_mpi_errors_throw_exceptions = {{{0}}}; -ompi_predefined_errhandler_t *ompi_mpi_errors_throw_exceptions_addr = - &ompi_mpi_errors_throw_exceptions; static opal_mutex_t errhandler_init_lock = OPAL_MUTEX_STATIC_INIT; ompi_errhandler_t* ompi_initial_error_handler_eh = NULL; @@ -192,26 +189,6 @@ int ompi_errhandler_init(void) "MPI_ERRORS_ABORT", sizeof(ompi_mpi_errors_abort.eh.eh_name)); - /* If we're going to use C++, functions will be fixed up during - MPI::Init. Note that it is proper to use ERRHANDLER_LANG_C here; - the dispatch function is in C (although in libmpi_cxx); the - conversion from C handles to C++ handles happens in that dispatch - function -- not the errhandler_invoke.c stuff here in libmpi. */ - OBJ_CONSTRUCT( &ompi_mpi_errors_throw_exceptions.eh, ompi_errhandler_t ); - ompi_mpi_errors_throw_exceptions.eh.eh_mpi_object_type = - OMPI_ERRHANDLER_TYPE_PREDEFINED; - ompi_mpi_errors_throw_exceptions.eh.eh_lang = OMPI_ERRHANDLER_LANG_C; - ompi_mpi_errors_throw_exceptions.eh.eh_comm_fn = - ompi_mpi_errors_are_fatal_comm_handler; - ompi_mpi_errors_throw_exceptions.eh.eh_file_fn = - ompi_mpi_errors_are_fatal_file_handler; - ompi_mpi_errors_throw_exceptions.eh.eh_win_fn = - ompi_mpi_errors_are_fatal_win_handler ; - ompi_mpi_errors_throw_exceptions.eh.eh_fort_fn = NULL; - opal_string_copy(ompi_mpi_errors_throw_exceptions.eh.eh_name, - "MPI_ERRORS_THROW_EXCEPTIONS", - sizeof(ompi_mpi_errors_throw_exceptions.eh.eh_name)); - /* Lets initialize the initial error handler if not already done */ char *env = getenv("OMPI_MCA_mpi_initial_errhandler"); if( NULL != env ) { @@ -228,7 +205,6 @@ int ompi_errhandler_finalize(void) { OBJ_DESTRUCT(&ompi_mpi_errhandler_null.eh); OBJ_DESTRUCT(&ompi_mpi_errors_return.eh); - OBJ_DESTRUCT(&ompi_mpi_errors_throw_exceptions.eh); OBJ_DESTRUCT(&ompi_mpi_errors_are_fatal.eh); /* JMS Add stuff here checking for unreleased errorhandlers, diff --git a/ompi/errhandler/errhandler.h b/ompi/errhandler/errhandler.h index 33bcaf7cf25..7f5e869d662 100644 --- a/ompi/errhandler/errhandler.h +++ b/ompi/errhandler/errhandler.h @@ -175,12 +175,6 @@ OMPI_DECLSPEC extern ompi_predefined_errhandler_t *ompi_mpi_errors_return_addr; OMPI_DECLSPEC extern ompi_predefined_errhandler_t ompi_mpi_errors_abort; OMPI_DECLSPEC extern ompi_predefined_errhandler_t *ompi_mpi_errors_abort_addr; -/** - * Global variable for MPI::ERRORS_THROW_EXCEPTIONS. Will abort if - * MPI_INIT wasn't called as MPI::INIT (_addr flavor is for F03 bindings) - */ -OMPI_DECLSPEC extern ompi_predefined_errhandler_t ompi_mpi_errors_throw_exceptions; - /** * Table for Fortran <-> C errhandler handle conversion */ From 20c772e733af2bba89f48147761d736937e6ad6c Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 17 Aug 2020 13:53:17 -0400 Subject: [PATCH 04/31] Cleanup language about MPI exceptions --> errors MPI-4 is finally cleaning up its language: an MPI "exception" does not actually exist. The only thing that exists is an MPI "error" (and associated handlers). This commit replaces all relevant uses of the word "exception" with "error". Note that this is still applicable in versions of the MPI standard less than MPI-4.0 (indeed, nearly all the cases fixed in this commit are just changes to comments, anyway). One exception to this is the Java bindings, where there's an MPIException class. In hindsight, it probably should have been named MPIError, but changing it now would break anyone who is using the Java bindings. Signed-off-by: Jeff Squyres --- ompi/communicator/comm_init.c | 2 +- ompi/errhandler/errhandler.h | 4 +- ompi/errhandler/errhandler_invoke.c | 8 +- ompi/mca/io/base/io_base_find_available.c | 2 +- ompi/mpi/c/errhandler_free.c | 2 +- ompi/mpi/java/java/CartComm.java | 20 +- ompi/mpi/java/java/Comm.java | 220 +++++++++--------- ompi/mpi/java/java/Datatype.java | 44 ++-- ompi/mpi/java/java/File.java | 120 +++++----- ompi/mpi/java/java/Freeable.java | 2 +- ompi/mpi/java/java/GraphComm.java | 14 +- ompi/mpi/java/java/Group.java | 22 +- ompi/mpi/java/java/Info.java | 16 +- ompi/mpi/java/java/Intercomm.java | 14 +- ompi/mpi/java/java/Intracomm.java | 72 +++--- ompi/mpi/java/java/MPI.java | 26 +-- ompi/mpi/java/java/MPIException.java | 9 +- ompi/mpi/java/java/Message.java | 8 +- ompi/mpi/java/java/Op.java | 2 +- ompi/mpi/java/java/Prequest.java | 4 +- ompi/mpi/java/java/Request.java | 36 +-- ompi/mpi/java/java/Status.java | 14 +- ompi/mpi/java/java/Struct.java | 22 +- ompi/mpi/java/java/UserFunction.java | 4 +- ompi/mpi/java/java/Win.java | 88 +++---- ompi/mpi/man/man3/MPI_Errhandler_create.3in | 2 +- .../man/man3/MPI_File_create_errhandler.3in | 2 +- ompi/mpi/man/man3/MPI_Get_count.3in | 2 +- ompi/mpi/man/man3/MPI_Init.3in | 2 +- ompi/mpi/man/man3/MPI_Test.3in | 2 +- ompi/mpi/man/man3/MPI_Testall.3in | 6 +- ompi/mpi/man/man3/MPI_Testany.3in | 2 +- ompi/mpi/man/man3/MPI_Testsome.3in | 6 +- ompi/mpi/man/man3/MPI_Wait.3in | 2 +- ompi/mpi/man/man3/MPI_Waitall.3in | 6 +- ompi/mpi/man/man3/MPI_Waitany.3in | 2 +- ompi/mpi/man/man3/MPI_Waitsome.3in | 6 +- ompi/runtime/ompi_mpi_finalize.c | 2 +- ompi/runtime/params.h | 2 +- 39 files changed, 411 insertions(+), 408 deletions(-) diff --git a/ompi/communicator/comm_init.c b/ompi/communicator/comm_init.c index 524394cf529..bcac9170452 100644 --- a/ompi/communicator/comm_init.c +++ b/ompi/communicator/comm_init.c @@ -419,7 +419,7 @@ static void ompi_comm_destruct(ompi_communicator_t* comm) from one communicator to another and we end up destroying the new communication while propagating the error up the stack. We want to make it all the way up the stack to invoke the MPI - exception, not cause a seg fault in pml_del_comm because it was + error, not cause a seg fault in pml_del_comm because it was never pml_add_com'ed. */ if ( MPI_COMM_NULL != comm && OMPI_COMM_IS_PML_ADDED(comm) ) { diff --git a/ompi/errhandler/errhandler.h b/ompi/errhandler/errhandler.h index 7f5e869d662..a41446159af 100644 --- a/ompi/errhandler/errhandler.h +++ b/ompi/errhandler/errhandler.h @@ -381,7 +381,7 @@ struct ompi_request_t; * * @returns err_code The same value as the parameter * - * This function invokes the MPI exception function on the error + * This function invokes the MPI error function on the error * handler. If the errhandler was created from fortran, the error * handler will be invoked with fortran linkage. Otherwise, it is * invoked with C linkage. @@ -394,7 +394,7 @@ struct ompi_request_t; /** - * Invoke an MPI exception on the first request found in the array + * Invoke an MPI error on the first request found in the array * that has a non-MPI_SUCCESS value for MPI_ERROR in its status. It * is safe to invoke this function if none of the requests have an * outstanding error; MPI_SUCCESS will be returned. diff --git a/ompi/errhandler/errhandler_invoke.c b/ompi/errhandler/errhandler_invoke.c index 3a0fb3cb4a2..b1ff233e821 100644 --- a/ompi/errhandler/errhandler_invoke.c +++ b/ompi/errhandler/errhandler_invoke.c @@ -141,7 +141,7 @@ int ompi_errhandler_request_invoke(int count, ompi_mpi_object_t mpi_object; /* Find the *first* request that has an error -- that's the one - that we'll invoke the exception on. In an error condition, the + that we'll invoke the error on. In an error condition, the request will not have been reset back to MPI_REQUEST_NULL, so there's no need to cache values from before we call ompi_request_test(). */ @@ -162,18 +162,18 @@ int ompi_errhandler_request_invoke(int count, /* Since errors on requests cause them to not be freed (until we can examine them here), go through and free all requests with - errors. We only invoke the exception on the *first* request + errors. We only invoke the error on the *first* request that had an error. */ for (; i < count; ++i) { if (MPI_REQUEST_NULL != requests[i] && MPI_SUCCESS != requests[i]->req_status.MPI_ERROR) { /* Ignore the error -- what are we going to do? We're - already going to invoke an exception */ + already going to invoke an error */ ompi_request_free(&(requests[i])); } } - /* Invoke the exception */ + /* Invoke the error */ switch (type) { case OMPI_REQUEST_PML: case OMPI_REQUEST_COLL: diff --git a/ompi/mca/io/base/io_base_find_available.c b/ompi/mca/io/base/io_base_find_available.c index 4b194e239ae..502140f2dee 100644 --- a/ompi/mca/io/base/io_base_find_available.c +++ b/ompi/mca/io/base/io_base_find_available.c @@ -53,7 +53,7 @@ static int init_query_2_0_0(const mca_base_component_t *ls, * and destroy the opened list. * * It is *not* an error if there are no io components available. - * Appropriate run-time MPI exceptions will be invoked during + * Appropriate run-time MPI errors will be invoked during * MPI_FILE_OPEN and MPI_FILE_DELETE. */ int mca_io_base_find_available(bool enable_progress_threads, diff --git a/ompi/mpi/c/errhandler_free.c b/ompi/mpi/c/errhandler_free.c index fd2991eefba..f7e2b7b689c 100644 --- a/ompi/mpi/c/errhandler_free.c +++ b/ompi/mpi/c/errhandler_free.c @@ -44,7 +44,7 @@ int MPI_Errhandler_free(MPI_Errhandler *errhandler) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - /* Raise an MPI exception if we got NULL or if we got an intrinsic + /* Raise an MPI error if we got NULL or if we got an intrinsic *and* the reference count is 1 (meaning that this FREE would actually free the underlying intrinsic object). This is ugly but necessary -- see below. */ diff --git a/ompi/mpi/java/java/CartComm.java b/ompi/mpi/java/java/CartComm.java index f5cd03e718e..87df031d151 100644 --- a/ompi/mpi/java/java/CartComm.java +++ b/ompi/mpi/java/java/CartComm.java @@ -92,7 +92,7 @@ protected CartComm(long[] commRequest) * Duplicates this communicator. *

Java binding of {@code MPI_COMM_DUP}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public CartComm dup() throws MPIException { @@ -106,7 +106,7 @@ protected CartComm(long[] commRequest) *

The new communicator can't be used before the operation completes. * The request object must be obtained calling {@link #getRequest}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. Signals that an MPI exception of some sort has occurred. */ @Override public CartComm iDup() throws MPIException { @@ -119,7 +119,7 @@ protected CartComm(long[] commRequest) *

Java binding of {@code MPI_COMM_DUP_WITH_INFO}. * @param info info object to associate with the new communicator * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public CartComm dupWithInfo(Info info) throws MPIException { @@ -134,7 +134,7 @@ protected CartComm(long[] commRequest) *

The number of dimensions can be obtained from the size of (eg) * {@code dims} field of the returned object. * @return object containing dimensions, periods and local coordinates - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public CartParms getTopo() throws MPIException { @@ -149,7 +149,7 @@ public CartParms getTopo() throws MPIException *

Java binding of the MPI operation {@code MPI_CART_RANK}. * @param coords Cartesian coordinates of a process * @return rank of the specified process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getRank(int[] coords) throws MPIException { @@ -164,7 +164,7 @@ public int getRank(int[] coords) throws MPIException *

Java binding of the MPI operation {@code MPI_CART_COORDS}. * @param rank rank of a process * @return Cartesian coordinates of the specified process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int[] getCoords(int rank) throws MPIException { @@ -180,7 +180,7 @@ public int[] getCoords(int rank) throws MPIException * @param direction coordinate dimension of shift * @param disp displacement * @return object containing ranks of source and destination processes - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public ShiftParms shift(int direction, int disp) throws MPIException { @@ -197,7 +197,7 @@ private native ShiftParms shift(long comm, int direction, int disp) * @param remainDims by dimension, {@code true} if dimension is to be kept, * {@code false} otherwise * @return communicator containing subgrid including this process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public CartComm sub(boolean[] remainDims) throws MPIException { @@ -215,7 +215,7 @@ public CartComm sub(boolean[] remainDims) throws MPIException * @param periods {@code true} if grid is periodic, * {@code false} if not, in each dimension * @return reordered rank of calling process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int map(int[] dims, boolean[] periods) throws MPIException { @@ -231,7 +231,7 @@ private native int map(long comm, int[] dims, boolean[] periods) *

Java binding of the MPI operation {@code MPI_DIMS_CREATE}. * @param nnodes number of nodes in a grid * @param dims array specifying the number of nodes in each dimension - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void createDims(int nnodes, int[] dims) throws MPIException { diff --git a/ompi/mpi/java/java/Comm.java b/ompi/mpi/java/java/Comm.java index 3d973163d91..90f8b9102df 100644 --- a/ompi/mpi/java/java/Comm.java +++ b/ompi/mpi/java/java/Comm.java @@ -128,7 +128,7 @@ protected final void setType(int type) * Duplicates this communicator. *

Java binding of {@code MPI_COMM_DUP}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Comm dup() throws MPIException { @@ -144,7 +144,7 @@ public Comm dup() throws MPIException *

The new communicator can't be used before the operation completes. * The request object must be obtained calling {@link #getRequest}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Comm iDup() throws MPIException { @@ -159,7 +159,7 @@ public Comm iDup() throws MPIException *

Java binding of {@code MPI_COMM_DUP_WITH_INFO}. * @param info info object to associate with the new communicator * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Comm dupWithInfo(Info info) throws MPIException { @@ -184,7 +184,7 @@ public final Request getRequest() * Size of group of this communicator. *

Java binding of the MPI operation {@code MPI_COMM_SIZE}. * @return number of processors in the group of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int getSize() throws MPIException { @@ -198,7 +198,7 @@ public final int getSize() throws MPIException * Rank of this process in group of this communicator. *

Java binding of the MPI operation {@code MPI_COMM_RANK}. * @return rank of the calling process in the group of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int getRank() throws MPIException { @@ -221,7 +221,7 @@ public final int getRank() throws MPIException * {@code MPI.SIMILAR} results if the underlying groups are similar * but the communicators differ by context.
* {@code MPI.UNEQUAL} results otherwise. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int compare(Comm comm1, Comm comm2) throws MPIException { @@ -233,7 +233,7 @@ public static int compare(Comm comm1, Comm comm2) throws MPIException /** * Java binding of the MPI operation {@code MPI_COMM_FREE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override final public void free() throws MPIException { @@ -256,7 +256,7 @@ public final boolean isNull() /** * Java binding of {@code MPI_COMM_SET_INFO}. * @param info info object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void setInfo(Info info) throws MPIException { @@ -269,7 +269,7 @@ public final void setInfo(Info info) throws MPIException /** * Java binding of {@code MPI_COMM_GET_INFO}. * @return new info object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Info getInfo() throws MPIException { @@ -281,7 +281,7 @@ public final Info getInfo() throws MPIException /** * Java binding of the MPI operation {@code MPI_COMM_DISCONNECT}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void disconnect() throws MPIException { @@ -295,7 +295,7 @@ public final void disconnect() throws MPIException * Return group associated with a communicator. *

Java binding of the MPI operation {@code MPI_COMM_GROUP}. * @return group corresponding to this communicator group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Group getGroup() throws MPIException { @@ -312,7 +312,7 @@ public final Group getGroup() throws MPIException *

Java binding of the MPI operation {@code MPI_COMM_TEST_INTER}. * @return {@code true} if this is an inter-communicator, * {@code false} otherwise - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final boolean isInter() throws MPIException { @@ -335,7 +335,7 @@ public final boolean isInter() throws MPIException * @param remoteLeader rank of remote group leader in this communicator * @param tag "safe" tag * @return new inter-communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intercomm createIntercomm(Comm localComm, int localLeader, int remoteLeader, int tag) @@ -361,7 +361,7 @@ private native long createIntercomm( * @param type datatype of each item in send buffer * @param dest rank of destination * @param tag message tag - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void send(Object buf, int count, Datatype type, int dest, int tag) throws MPIException @@ -392,7 +392,7 @@ private native void send( * @param source rank of source * @param tag message tag * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Status recv(Object buf, int count, Datatype type, int source, int tag) @@ -437,7 +437,7 @@ private native void recv( * @param source rank of source * @param recvtag receive tag * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) * @see mpi.Comm#recv(Object, int, Datatype, int, int) */ @@ -495,7 +495,7 @@ private native void sendRecv( * @param source rank of source * @param recvtag receive tag * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) * @see mpi.Comm#recv(Object, int, Datatype, int, int) */ @@ -537,7 +537,7 @@ private native void sendRecvReplace( * @param type datatype of each item in send buffer * @param dest rank of destination * @param tag message tag - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final void bSend(Object buf, int count, Datatype type, int dest, int tag) @@ -568,7 +568,7 @@ private native void bSend( * @param type datatype of each item in send buffer * @param dest rank of destination * @param tag message tag - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final void sSend(Object buf, int count, Datatype type, int dest, int tag) @@ -599,7 +599,7 @@ private native void sSend( * @param type datatype of each item in send buffer * @param dest rank of destination * @param tag message tag - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final void rSend(Object buf, int count, Datatype type, int dest, int tag) @@ -633,7 +633,7 @@ private native void rSend( * @param dest rank of destination * @param tag message tag * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final Request iSend(Buffer buf, int count, @@ -660,7 +660,7 @@ private native long iSend( * @param dest rank of destination * @param tag message tag * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final Request ibSend(Buffer buf, int count, @@ -687,7 +687,7 @@ private native long ibSend( * @param dest rank of destination * @param tag message tag * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final Request isSend(Buffer buf, int count, @@ -714,7 +714,7 @@ private native long isSend( * @param dest rank of destination * @param tag message tag * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final Request irSend(Buffer buf, int count, @@ -741,7 +741,7 @@ private native long irSend( * @param source rank of source * @param tag message tag * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#recv(Object, int, Datatype, int, int) */ public final Request iRecv(Buffer buf, int count, @@ -771,7 +771,7 @@ private native long iRecv( * @param dest rank of destination * @param tag message tag * @return persistent communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final Prequest sendInit(Buffer buf, int count, @@ -798,7 +798,7 @@ private native long sendInit( * @param dest rank of destination * @param tag message tag * @return persistent communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final Prequest bSendInit(Buffer buf, int count, @@ -825,7 +825,7 @@ private native long bSendInit( * @param dest rank of destination * @param tag message tag * @return persistent communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final Prequest sSendInit(Buffer buf, int count, @@ -852,7 +852,7 @@ private native long sSendInit( * @param dest rank of destination * @param tag message tag * @return persistent communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#send(Object, int, Datatype, int, int) */ public final Prequest rSendInit(Buffer buf, int count, @@ -879,7 +879,7 @@ private native long rSendInit( * @param source rank of source * @param tag message tag * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. * @see mpi.Comm#recv(Object, int, Datatype, int, int) */ public final Prequest recvInit(Buffer buf, int count, @@ -913,7 +913,7 @@ private native long recvInit( * @param outbuf output buffer * @param position initial position in output buffer * @return final position in output buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int pack(Object inbuf, int incount, Datatype type, byte[] outbuf, int position) @@ -951,7 +951,7 @@ private native int pack( * @param outcount number of items in output buffer * @param type datatype of each item in output buffer * @return final position in input buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int unpack(byte[] inbuf, int position, Object outbuf, int outcount, Datatype type) @@ -982,7 +982,7 @@ private native int unpack( * @param incount number of items in input buffer * @param type datatype of each item in input buffer * @return upper bound on size of packed message - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int packSize(int incount, Datatype type) throws MPIException { @@ -1004,7 +1004,7 @@ private native int packSize(long comm, int incount, long type) * @param tag message tag * @return status object if such a message is currently available, * {@code null} otherwise. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Status iProbe(int source, int tag) throws MPIException { @@ -1023,7 +1023,7 @@ private native Status iProbe(long comm, int source, int tag) * @param source rank of source * @param tag message tag * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Status probe(int source, int tag) throws MPIException { @@ -1042,7 +1042,7 @@ private native void probe(long comm, int source, int tag, long[] stat) * Create a new attribute key. *

Java binding of the MPI operation {@code MPI_COMM_CREATE_KEYVAL}. * @return attribute key for future access - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int createKeyval() throws MPIException { @@ -1056,7 +1056,7 @@ public static int createKeyval() throws MPIException * Frees an attribute key for communicators. *

Java binding of the MPI operation {@code MPI_COMM_FREE_KEYVAL}. * @param keyval attribute key - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void freeKeyval(int keyval) throws MPIException { @@ -1071,7 +1071,7 @@ public static void freeKeyval(int keyval) throws MPIException *

Java binding of the MPI operation {@code MPI_COMM_SET_ATTR}. * @param keyval attribute key * @param value attribute value - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void setAttr(int keyval, Object value) throws MPIException { @@ -1087,7 +1087,7 @@ private native void setAttr(long comm, int keyval, byte[] value) *

Java binding of the MPI operation {@code MPI_COMM_GET_ATTR}. * @param keyval attribute key * @return attribute value or null if no attribute is associated with the key. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Object getAttr(int keyval) throws MPIException { @@ -1122,7 +1122,7 @@ private native Object getAttr_predefined(long comm, int keyval) * Deletes an attribute value associated with a key on a communicator. *

Java binding of the MPI operation {@code MPI_COMM_DELETE_ATTR}. * @param keyval attribute key - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void deleteAttr(int keyval) throws MPIException { @@ -1140,7 +1140,7 @@ public final void deleteAttr(int keyval) throws MPIException *

The return value will be one of {@code MPI.GRAPH}, {@code MPI.CART}, * {@code MPI.DIST_GRAPH} or {@code MPI.UNDEFINED}. * @return topology type of communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int getTopology() throws MPIException { @@ -1156,7 +1156,7 @@ public final int getTopology() throws MPIException * Abort MPI. *

Java binding of the MPI operation {@code MPI_ABORT}. * @param errorcode error code for Unix or POSIX environments - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void abort(int errorcode) throws MPIException { @@ -1172,7 +1172,7 @@ public final void abort(int errorcode) throws MPIException * Associates a new error handler with communicator at the calling process. *

Java binding of the MPI operation {@code MPI_COMM_SET_ERRHANDLER}. * @param errhandler new MPI error handler for communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void setErrhandler(Errhandler errhandler) throws MPIException { @@ -1187,7 +1187,7 @@ private native void setErrhandler(long comm, long errhandler) * Returns the error handler currently associated with the communicator. *

Java binding of the MPI operation {@code MPI_COMM_GET_ERRHANDLER}. * @return MPI error handler currently associated with communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Errhandler getErrhandler() throws MPIException { @@ -1201,7 +1201,7 @@ public final Errhandler getErrhandler() throws MPIException * Calls the error handler currently associated with the communicator. *

Java binding of the MPI operation {@code MPI_COMM_CALL_ERRHANDLER}. * @param errorCode error code - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void callErrhandler(int errorCode) throws MPIException { @@ -1217,7 +1217,7 @@ private native void callErrhandler(long handle, int errorCode) * A call to {@code barrier} blocks the caller until all process * in the group have called it. *

Java binding of the MPI operation {@code MPI_BARRIER}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void barrier() throws MPIException { @@ -1231,7 +1231,7 @@ public final void barrier() throws MPIException * Nonblocking barrier synchronization. *

Java binding of the MPI operation {@code MPI_IBARRIER}. * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iBarrier() throws MPIException { @@ -1249,7 +1249,7 @@ public final Request iBarrier() throws MPIException * @param count number of items in buffer * @param type datatype of each item in buffer * @param root rank of broadcast root - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void bcast(Object buf, int count, Datatype type, int root) throws MPIException @@ -1280,7 +1280,7 @@ private native void bcast( * @param type datatype of each item in buffer * @param root rank of broadcast root * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iBcast(Buffer buf, int count, Datatype type, int root) throws MPIException @@ -1306,7 +1306,7 @@ private native long iBcast( * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer * @param root rank of receiving process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void gather( Object sendbuf, int sendcount, Datatype sendtype, @@ -1349,7 +1349,7 @@ public final void gather( * @param count number of items to send/receive * @param type datatype of each item in buffer * @param root rank of receiving process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void gather(Object buf, int count, Datatype type, int root) throws MPIException @@ -1386,7 +1386,7 @@ private native void gather( * @param recvtype datatype of each item in receive buffer * @param root rank of receiving process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iGather( Buffer sendbuf, int sendcount, Datatype sendtype, @@ -1413,7 +1413,7 @@ public final Request iGather( * @param type datatype of each item in buffer * @param root rank of receiving process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iGather(Buffer buf, int count, Datatype type, int root) throws MPIException @@ -1443,7 +1443,7 @@ private native long iGather( * @param displs displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer * @param root rank of receiving process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void gatherv(Object sendbuf, int sendcount, Datatype sendtype, Object recvbuf, int[] recvcount, int[] displs, @@ -1487,7 +1487,7 @@ public final void gatherv(Object sendbuf, int sendcount, Datatype sendtype, * @param displs displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer * @param root rank of receiving process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void gatherv(Object recvbuf, int[] recvcount, int[] displs, Datatype recvtype, int root) @@ -1517,7 +1517,7 @@ public final void gatherv(Object recvbuf, int[] recvcount, int[] displs, * @param sendcount number of items to send * @param sendtype datatype of each item in send buffer * @param root rank of receiving process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void gatherv(Object sendbuf, int sendcount, Datatype sendtype, int root) @@ -1558,7 +1558,7 @@ private native void gatherv( * @param recvtype datatype of each item in receive buffer * @param root rank of receiving process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iGatherv( Buffer sendbuf, int sendcount, Datatype sendtype, Buffer recvbuf, @@ -1586,7 +1586,7 @@ public final Request iGatherv( * @param recvtype datatype of each item in receive buffer * @param root rank of receiving process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iGatherv(Buffer recvbuf, int[] recvcount, int[] displs, Datatype recvtype, int root) @@ -1611,7 +1611,7 @@ public final Request iGatherv(Buffer recvbuf, int[] recvcount, int[] displs, * @param sendtype datatype of each item in send buffer * @param root rank of receiving process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iGatherv(Buffer sendbuf, int sendcount, Datatype sendtype, int root) @@ -1641,7 +1641,7 @@ private native long iGatherv( * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer * @param root rank of sending process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void scatter( Object sendbuf, int sendcount, Datatype sendtype, @@ -1684,7 +1684,7 @@ public final void scatter( * @param count number of items to send/receive * @param type datatype of each item in buffer * @param root rank of sending process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void scatter(Object buf, int count, Datatype type, int root) throws MPIException @@ -1720,7 +1720,7 @@ private native void scatter( * @param recvtype datatype of each item in receive buffer * @param root rank of sending process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iScatter( Buffer sendbuf, int sendcount, Datatype sendtype, @@ -1747,7 +1747,7 @@ public final Request iScatter( * @param type datatype of each item in buffer * @param root rank of sending process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iScatter(Buffer buf, int count, Datatype type, int root) throws MPIException @@ -1776,7 +1776,7 @@ private native long iScatter( * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer * @param root rank of sending process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void scatterv( Object sendbuf, int[] sendcount, int[] displs, Datatype sendtype, @@ -1819,7 +1819,7 @@ public final void scatterv( * @param displs displacements from which to take outgoing data * @param sendtype datatype of each item in send buffer * @param root rank of sending process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void scatterv(Object sendbuf, int[] sendcount, int[] displs, Datatype sendtype, int root) @@ -1849,7 +1849,7 @@ public final void scatterv(Object sendbuf, int[] sendcount, int[] displs, * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer * @param root rank of sending process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void scatterv(Object recvbuf, int recvcount, Datatype recvtype, int root) @@ -1889,7 +1889,7 @@ private native void scatterv( * @param recvtype datatype of each item in receive buffer * @param root rank of sending process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iScatterv( Buffer sendbuf, int[] sendcount, int[] displs, Datatype sendtype, @@ -1917,7 +1917,7 @@ public final Request iScatterv( * @param sendtype datatype of each item in send buffer * @param root rank of sending process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iScatterv(Buffer sendbuf, int[] sendcount, int[] displs, Datatype sendtype, int root) @@ -1941,7 +1941,7 @@ public final Request iScatterv(Buffer sendbuf, int[] sendcount, int[] displs, * @param recvtype datatype of each item in receive buffer * @param root rank of sending process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iScatterv(Buffer recvbuf, int recvcount, Datatype recvtype, int root) @@ -1969,7 +1969,7 @@ private native long iScatterv( * @param recvbuf receive buffer * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allGather(Object sendbuf, int sendcount, Datatype sendtype, Object recvbuf, int recvcount, Datatype recvtype) @@ -2008,7 +2008,7 @@ public final void allGather(Object sendbuf, int sendcount, Datatype sendtype, * @param buf receive buffer * @param count number of items to receive * @param type datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allGather(Object buf, int count, Datatype type) throws MPIException @@ -2043,7 +2043,7 @@ private native void allGather( * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllGather( Buffer sendbuf, int sendcount, Datatype sendtype, @@ -2067,7 +2067,7 @@ public final Request iAllGather( * @param count number of items to receive * @param type datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllGather(Buffer buf, int count, Datatype type) throws MPIException @@ -2093,7 +2093,7 @@ private native long iAllGather( * @param recvcount number of elements received from each process * @param displs displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allGatherv( Object sendbuf, int sendcount, Datatype sendtype, @@ -2134,7 +2134,7 @@ public final void allGatherv( * @param recvcount number of elements received from each process * @param displs displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allGatherv(Object recvbuf, int[] recvcount, int[] displs, Datatype recvtype) @@ -2172,7 +2172,7 @@ private native void allGatherv( * @param displs displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllGatherv( Buffer sendbuf, int sendcount, Datatype sendtype, @@ -2198,7 +2198,7 @@ public final Request iAllGatherv( * @param displs displacements at which to place incoming data * @param type datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllGatherv( Buffer buf, int[] count, int[] displs, Datatype type) @@ -2227,7 +2227,7 @@ private native long iAllGatherv( * @param recvbuf receive buffer * @param recvcount number of items received from any process * @param recvtype datatype of receive buffer items - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allToAll(Object sendbuf, int sendcount, Datatype sendtype, Object recvbuf, int recvcount, Datatype recvtype) @@ -2276,7 +2276,7 @@ private native void allToAll( * @param recvcount number of items received from any process * @param recvtype datatype of receive buffer items * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllToAll(Buffer sendbuf, int sendcount, Datatype sendtype, Buffer recvbuf, int recvcount, Datatype recvtype) @@ -2308,7 +2308,7 @@ private native long iAllToAll( * @param recvcount number of elements received from each process * @param rdispls displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allToAllv( Object sendbuf, int[] sendcount, int[] sdispls, Datatype sendtype, @@ -2362,7 +2362,7 @@ private native void allToAllv( * @param rdispls displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllToAllv( Buffer sendbuf, int[] sendcount, int[] sdispls, Datatype sendtype, @@ -2397,7 +2397,7 @@ private native long iAllToAllv(long comm, * @param recvCount number of elements received from each process * @param rDispls displacements at which to place incoming data * @param recvTypes datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allToAllw( Object sendBuf, int[] sendCount, int[] sDispls, Datatype[] sendTypes, @@ -2461,7 +2461,7 @@ private native void allToAllw(long comm, * @param rDispls displacements at which to place incoming data * @param recvTypes datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllToAllw( Buffer sendBuf, int[] sendCount, int[] sDispls, Datatype[] sendTypes, @@ -2494,7 +2494,7 @@ private native long iAllToAllw(long comm, * @param recvbuf receive buffer * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void neighborAllGather( Object sendbuf, int sendcount, Datatype sendtype, @@ -2543,7 +2543,7 @@ private native void neighborAllGather( * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iNeighborAllGather( Buffer sendbuf, int sendcount, Datatype sendtype, @@ -2574,7 +2574,7 @@ private native long iNeighborAllGather( * @param recvcount number of elements that are received from each neighbor * @param displs displacements at which to place incoming data * @param recvtype datatype of receive buffer elements - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void neighborAllGatherv( Object sendbuf, int sendcount, Datatype sendtype, @@ -2623,7 +2623,7 @@ private native void neighborAllGatherv( * @param displs displacements at which to place incoming data * @param recvtype datatype of receive buffer elements * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iNeighborAllGatherv( Buffer sendbuf, int sendcount, Datatype sendtype, @@ -2653,7 +2653,7 @@ private native long iNeighborAllGatherv( * @param recvbuf receive buffer * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void neighborAllToAll( Object sendbuf, int sendcount, Datatype sendtype, @@ -2702,7 +2702,7 @@ private native void neighborAllToAll( * @param recvcount number of items to receive * @param recvtype datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iNeighborAllToAll( Buffer sendbuf, int sendcount, Datatype sendtype, @@ -2733,7 +2733,7 @@ private native long iNeighborAllToAll( * @param recvcount number of elements received from each process * @param rdispls displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void neighborAllToAllv( Object sendbuf, int[] sendcount, int[] sdispls, Datatype sendtype, @@ -2785,7 +2785,7 @@ private native void neighborAllToAllv( * @param rdispls displacements at which to place incoming data * @param recvtype datatype of each item in receive buffer * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iNeighborAllToAllv( Buffer sendbuf, int[] sendcount, int[] sdispls, Datatype sendtype, @@ -2824,7 +2824,7 @@ private native long iNeighborAllToAllv( * @param type data type of each item in send buffer * @param op reduce operation * @param root rank of root process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void reduce(Object sendbuf, Object recvbuf, int count, Datatype type, Op op, int root) @@ -2866,7 +2866,7 @@ public final void reduce(Object sendbuf, Object recvbuf, int count, * @param type data type of each item in buffer * @param op reduce operation * @param root rank of root process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void reduce(Object buf, int count, Datatype type, Op op, int root) throws MPIException @@ -2904,7 +2904,7 @@ private native void reduce( * @param op reduce operation * @param root rank of root process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iReduce(Buffer sendbuf, Buffer recvbuf, int count, Datatype type, Op op, int root) @@ -2933,7 +2933,7 @@ public final Request iReduce(Buffer sendbuf, Buffer recvbuf, * @param op reduce operation * @param root rank of root process * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iReduce(Buffer buf, int count, Datatype type, Op op, int root) @@ -2963,7 +2963,7 @@ private native long iReduce( * @param count number of items in send buffer * @param type data type of each item in send buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allReduce(Object sendbuf, Object recvbuf, int count, Datatype type, Op op) @@ -3003,7 +3003,7 @@ public final void allReduce(Object sendbuf, Object recvbuf, * @param count number of items in send buffer * @param type data type of each item in send buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void allReduce(Object buf, int count, Datatype type, Op op) throws MPIException @@ -3038,7 +3038,7 @@ private native void allReduce( * @param type data type of each item in send buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllReduce(Buffer sendbuf, Buffer recvbuf, int count, Datatype type, Op op) @@ -3064,7 +3064,7 @@ public final Request iAllReduce(Buffer sendbuf, Buffer recvbuf, * @param type data type of each item in send buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iAllReduce(Buffer buf, int count, Datatype type, Op op) throws MPIException @@ -3093,7 +3093,7 @@ private native long iAllReduce( * @param recvcounts numbers of result elements distributed to each process * @param type data type of each item in send buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void reduceScatter(Object sendbuf, Object recvbuf, int[] recvcounts, Datatype type, Op op) @@ -3134,7 +3134,7 @@ public final void reduceScatter(Object sendbuf, Object recvbuf, * @param counts numbers of result elements distributed to each process * @param type data type of each item in send buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void reduceScatter(Object buf, int[] counts, Datatype type, Op op) throws MPIException @@ -3170,7 +3170,7 @@ private native void reduceScatter( * @param type data type of each item in send buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iReduceScatter(Buffer sendbuf, Buffer recvbuf, int[] recvcounts, Datatype type, Op op) @@ -3198,7 +3198,7 @@ public final Request iReduceScatter(Buffer sendbuf, Buffer recvbuf, * @param type data type of each item in send buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iReduceScatter( Buffer buf, int[] counts, Datatype type, Op op) @@ -3226,7 +3226,7 @@ private native long iReduceScatter( * @param recvcount element count per block * @param type data type of each item in send buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void reduceScatterBlock(Object sendbuf, Object recvbuf, int recvcount, Datatype type, Op op) @@ -3265,7 +3265,7 @@ public final void reduceScatterBlock(Object sendbuf, Object recvbuf, * @param count element count per block * @param type data type of each item in send buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void reduceScatterBlock( Object buf, int count, Datatype type, Op op) @@ -3300,7 +3300,7 @@ private native void reduceScatterBlock( * @param type data type of each item in send buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iReduceScatterBlock( Buffer sendbuf, Buffer recvbuf, int recvcount, Datatype type, Op op) @@ -3326,7 +3326,7 @@ public final Request iReduceScatterBlock( * @param type data type of each item in send buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iReduceScatterBlock( Buffer buf, int count, Datatype type, Op op) @@ -3356,7 +3356,7 @@ private native long iReduceScatterBlock( * @param count number of elements * @param type data type of each item * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void reduceLocal( Object inBuf, Object inOutBuf, int count, Datatype type, Op op) @@ -3408,7 +3408,7 @@ private static native void reduceLocalUf( /** * Sets the print name for the communicator. * @param name name for the communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void setName(String name) throws MPIException { @@ -3421,7 +3421,7 @@ public final void setName(String name) throws MPIException /** * Return the print name from the communicator. * @return name of the communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final String getName() throws MPIException { diff --git a/ompi/mpi/java/java/Datatype.java b/ompi/mpi/java/java/Datatype.java index 992670abc6f..379343fc5ba 100644 --- a/ompi/mpi/java/java/Datatype.java +++ b/ompi/mpi/java/java/Datatype.java @@ -140,7 +140,7 @@ private Datatype(int baseType, int baseSize, long handle) * Returns the lower bound of a datatype. *

Java binding of the MPI operation {@code MPI_TYPE_GET_EXTENT}. * @return lower bound of datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getLb() throws MPIException { @@ -154,7 +154,7 @@ public int getLb() throws MPIException * Returns the extent of a datatype. *

Java binding of the MPI operation {@code MPI_TYPE_GET_EXTENT}. * @return datatype extent - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getExtent() throws MPIException { @@ -179,7 +179,7 @@ private void getLbExtent() throws MPIException * Returns the true lower bound of a datatype. *

Java binding of the MPI operation {@code MPI_TYPE_GET_TRUE_EXTENT}. * @return lower bound of datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getTrueLb() throws MPIException { @@ -193,7 +193,7 @@ public int getTrueLb() throws MPIException * Returns the true extent of a datatype. *

Java binding of the MPI operation {@code MPI_TYPE_GET_TRUE_EXTENT}. * @return datatype true extent - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getTrueExtent() throws MPIException { @@ -219,7 +219,7 @@ private void getTrueLbExtent() throws MPIException * elements it represents. *

Java binding of the MPI operation {@code MPI_TYPE_SIZE}. * @return datatype size - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getSize() throws MPIException { @@ -232,7 +232,7 @@ public int getSize() throws MPIException /** * Commits a derived datatype. * Java binding of the MPI operation {@code MPI_TYPE_COMMIT}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void commit() throws MPIException { @@ -245,7 +245,7 @@ public void commit() throws MPIException /** * Frees the datatype. *

Java binding of the MPI operation {@code MPI_TYPE_FREE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public void free() throws MPIException { @@ -285,7 +285,7 @@ public boolean isNull() /** * Java binding of {@code MPI_TYPE_DUP}. * @return new datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Datatype dup() throws MPIException { @@ -304,7 +304,7 @@ public Datatype dup() throws MPIException * @param count replication count * @param oldType old datatype * @return new datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Datatype createContiguous(int count, Datatype oldType) throws MPIException @@ -326,7 +326,7 @@ public static Datatype createContiguous(int count, Datatype oldType) * @param stride number of elements between start of each block * @param oldType old datatype * @return new datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Datatype createVector(int count, int blockLength, int stride, Datatype oldType) @@ -351,7 +351,7 @@ private static native long getVector( * @param stride number of bytes between start of each block * @param oldType old datatype * @return new datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Datatype createHVector(int count, int blockLength, int stride, Datatype oldType) @@ -379,7 +379,7 @@ private static native long getHVector( * @param displacements displacement of each block in units of old type * @param oldType old datatype * @return new datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Datatype createIndexed(int[] blockLengths, int[] displacements, Datatype oldType) @@ -403,7 +403,7 @@ private static native long getIndexed( * @param displacements byte displacement in buffer for each block * @param oldType old datatype * @return new datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Datatype createHIndexed(int[] blockLengths, int[] displacements, Datatype oldType) @@ -428,7 +428,7 @@ private static native long getHIndexed( * @param displacements byte displacement of each block * @param types type of elements in each block * @return new datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Datatype createStruct(int[] blockLengths, int[] displacements, Datatype[] types) @@ -455,7 +455,7 @@ private static native long getStruct( * @param lb new lower bound of datatype (address integer) * @param extent new extent of datatype (address integer) * @return new datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Datatype createResized(Datatype oldType, int lb, int extent) throws MPIException @@ -470,7 +470,7 @@ public static Datatype createResized(Datatype oldType, int lb, int extent) /** * Sets the print name for the datatype. * @param name name for the datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setName(String name) throws MPIException { @@ -483,7 +483,7 @@ public void setName(String name) throws MPIException /** * Return the print name from the datatype. * @return name of the datatype - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public String getName() throws MPIException { @@ -497,7 +497,7 @@ public String getName() throws MPIException * Create a new attribute key. *

Java binding of the MPI operation {@code MPI_TYPE_CREATE_KEYVAL}. * @return attribute key for future access - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int createKeyval() throws MPIException { @@ -511,7 +511,7 @@ public static int createKeyval() throws MPIException * Frees an attribute key. *

Java binding of the MPI operation {@code MPI_TYPE_FREE_KEYVAL}. * @param keyval attribute key - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void freeKeyval(int keyval) throws MPIException { @@ -526,7 +526,7 @@ public static void freeKeyval(int keyval) throws MPIException *

Java binding of the MPI operation {@code MPI_TYPE_SET_ATTR}. * @param keyval attribute key * @param value attribute value - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setAttr(int keyval, Object value) throws MPIException { @@ -542,7 +542,7 @@ private native void setAttr(long type, int keyval, byte[] value) *

Java binding of the MPI operation {@code MPI_TYPE_GET_ATTR}. * @param keyval attribute key * @return attribute value or null if no attribute is associated with the key. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Object getAttr(int keyval) throws MPIException { @@ -557,7 +557,7 @@ public Object getAttr(int keyval) throws MPIException * Deletes an attribute value associated with a key. *

Java binding of the MPI operation {@code MPI_TYPE_DELETE_ATTR}. * @param keyval attribute key - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void deleteAttr(int keyval) throws MPIException { diff --git a/ompi/mpi/java/java/File.java b/ompi/mpi/java/java/File.java index 34506adc83d..08534be2744 100644 --- a/ompi/mpi/java/java/File.java +++ b/ompi/mpi/java/java/File.java @@ -48,7 +48,7 @@ public final class File * @param comm communicator * @param filename name of the file to open * @param amode file access mode - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public File(Comm comm, String filename, int amode) throws MPIException { @@ -62,7 +62,7 @@ public File(Comm comm, String filename, int amode) throws MPIException * @param filename name of the file to open * @param amode file access mode * @param info info object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public File(Comm comm, String filename, int amode, Info info) throws MPIException @@ -76,7 +76,7 @@ private native long open(long comm, String filename, int amode, long info) /** * Java binding of {@code MPI_FILE_CLOSE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void close() throws MPIException { @@ -89,7 +89,7 @@ public void close() throws MPIException /** * Java binding of {@code MPI_FILE_DELETE} using {@code MPI_INFO_NULL}. * @param filename name of the file to delete - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void delete(String filename) throws MPIException { @@ -101,7 +101,7 @@ public static void delete(String filename) throws MPIException * Java binding of {@code MPI_FILE_DELETE}. * @param filename name of the file to delete * @param info info object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void delete(String filename, Info info) throws MPIException { @@ -115,7 +115,7 @@ private static native void delete(String filename, long info) /** * Java binding of {@code MPI_FILE_SET_SIZE}. * @param size size to truncate or expand file - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setSize(long size) throws MPIException { @@ -128,7 +128,7 @@ public void setSize(long size) throws MPIException /** * Java binding of {@code MPI_FILE_PREALLOCATE}. * @param size size to preallocate file - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void preallocate(long size) throws MPIException { @@ -141,7 +141,7 @@ public void preallocate(long size) throws MPIException /** * Java binding of {@code MPI_FILE_GET_SIZE}. * @return size of file in bytes - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public long getSize() throws MPIException { @@ -154,7 +154,7 @@ public long getSize() throws MPIException /** * Java binding of {@code MPI_FILE_GET_GROUP}. * @return group which opened the file - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Group getGroup() throws MPIException { @@ -167,7 +167,7 @@ public Group getGroup() throws MPIException /** * Java binding of {@code MPI_FILE_GET_AMODE}. * @return file access mode to open the file - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getAMode() throws MPIException { @@ -180,7 +180,7 @@ public int getAMode() throws MPIException /** * Java binding of {@code MPI_FILE_SET_INFO}. * @param info info object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setInfo(Info info) throws MPIException { @@ -193,7 +193,7 @@ public void setInfo(Info info) throws MPIException /** * Java binding of {@code MPI_FILE_GET_INFO}. * @return new info object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Info getInfo() throws MPIException { @@ -209,7 +209,7 @@ public Info getInfo() throws MPIException * @param etype elementary datatype * @param filetype filetype * @param datarep data representation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setView(long disp, Datatype etype, Datatype filetype, String datarep) @@ -227,7 +227,7 @@ public void setView(long disp, Datatype etype, * @param filetype filetype * @param datarep data representation * @param info info object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setView(long disp, Datatype etype, Datatype filetype, String datarep, Info info) @@ -258,7 +258,7 @@ public FileView getView() * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status readAt(long offset, Object buf, int count, Datatype type) throws MPIException @@ -291,7 +291,7 @@ private native void readAt( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status readAtAll(long offset, Object buf, int count, Datatype type) throws MPIException @@ -324,7 +324,7 @@ private native void readAtAll( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status writeAt(long offset, Object buf, int count, Datatype type) throws MPIException @@ -357,7 +357,7 @@ private native void writeAt( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status writeAtAll(long offset, Object buf, int count, Datatype type) throws MPIException @@ -390,7 +390,7 @@ private native void writeAtAll( * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iReadAt(long offset, Buffer buf, int count, Datatype type) throws MPIException @@ -413,7 +413,7 @@ private native long iReadAt( * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iReadAtAll(long offset, Buffer buf, int count, Datatype type) throws MPIException @@ -436,7 +436,7 @@ private native long iReadAtAll( * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iWriteAt(long offset, Buffer buf, int count, Datatype type) throws MPIException @@ -459,7 +459,7 @@ private native long iWriteAt( * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iWriteAtAll(long offset, Buffer buf, int count, Datatype type) throws MPIException @@ -481,7 +481,7 @@ private native long iWriteAtAll( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status read(Object buf, int count, Datatype type) throws MPIException { @@ -510,7 +510,7 @@ private native void read( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status readAll(Object buf, int count, Datatype type) throws MPIException { @@ -539,7 +539,7 @@ private native void readAll( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status write(Object buf, int count, Datatype type) throws MPIException { @@ -568,7 +568,7 @@ private native void write( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status writeAll(Object buf, int count, Datatype type) throws MPIException { @@ -597,7 +597,7 @@ private native void writeAll( * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iRead(Buffer buf, int count, Datatype type) throws MPIException { @@ -617,7 +617,7 @@ private native long iRead(long fh, Buffer buf, int count, long type) * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iReadAll(Buffer buf, int count, Datatype type) throws MPIException { @@ -637,7 +637,7 @@ private native long iReadAll(long fh, Buffer buf, int count, long type) * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iWrite(Buffer buf, int count, Datatype type) throws MPIException { @@ -657,7 +657,7 @@ private native long iWrite(long fh, Buffer buf, int count, long type) * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iWriteAll(Buffer buf, int count, Datatype type) throws MPIException { @@ -675,7 +675,7 @@ private native long iWriteAll(long fh, Buffer buf, int count, long type) * Java binding of {@code MPI_FILE_SEEK}. * @param offset file offset * @param whence update mode - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void seek(long offset, int whence) throws MPIException { @@ -688,7 +688,7 @@ public void seek(long offset, int whence) throws MPIException /** * Java binding of {@code MPI_FILE_GET_POSITION}. * @return offset of individual pointer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public long getPosition() throws MPIException { @@ -702,7 +702,7 @@ public long getPosition() throws MPIException * Java binding of {@code MPI_FILE_GET_BYTE_OFFSET}. * @param offset offset * @return absolute byte position of offset - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public long getByteOffset(long offset) throws MPIException { @@ -718,7 +718,7 @@ public long getByteOffset(long offset) throws MPIException * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status readShared(Object buf, int count, Datatype type) throws MPIException @@ -750,7 +750,7 @@ private native void readShared( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status writeShared(Object buf, int count, Datatype type) throws MPIException @@ -782,7 +782,7 @@ private native void writeShared( * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iReadShared(Buffer buf, int count, Datatype type) throws MPIException @@ -803,7 +803,7 @@ private native long iReadShared(long fh, Buffer buf, int count, long type) * @param count number of items in buffer * @param type datatype of each buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request iWriteShared(Buffer buf, int count, Datatype type) throws MPIException @@ -824,7 +824,7 @@ private native long iWriteShared(long fh, Buffer buf, int count, long type) * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status readOrdered(Object buf, int count, Datatype type) throws MPIException @@ -856,7 +856,7 @@ private native void readOrdered( * @param count number of items in buffer * @param type datatype of each buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status writeOrdered(Object buf, int count, Datatype type) throws MPIException @@ -886,7 +886,7 @@ private native void writeOrdered( * Java binding of {@code MPI_FILE_SEEK_SHARED}. * @param offset file offset * @param whence update mode - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void seekShared(long offset, int whence) throws MPIException { @@ -900,7 +900,7 @@ private native void seekShared(long fh, long offset, int whence) /** * Java binding of {@code MPI_FILE_GET_POSITION_SHARED}. * @return offset of individual pointer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public long getPositionShared() throws MPIException { @@ -916,7 +916,7 @@ public long getPositionShared() throws MPIException * @param buf buffer * @param count number of items in buffer * @param type datatype of each buffer element - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void readAtAllBegin(long offset, Object buf, int count, Datatype type) throws MPIException @@ -953,7 +953,7 @@ private native void readAtAllBegin( * Java binding of {@code MPI_FILE_READ_AT_ALL_END}. * @param buf buffer * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status readAtAllEnd(Object buf) throws MPIException { @@ -980,7 +980,7 @@ private native void readAtAllEnd(long fh, Object buf, long[] stat) * @param buf buffer * @param count number of items in buffer * @param type datatype of each buffer element - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void writeAtAllBegin(long offset, Object buf, int count, Datatype type) throws MPIException @@ -1017,7 +1017,7 @@ private native void writeAtAllBegin( * Java binding of {@code MPI_FILE_WRITE_AT_ALL_END}. * @param buf buffer * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status writeAtAllEnd(Object buf) throws MPIException { @@ -1043,7 +1043,7 @@ private native void writeAtAllEnd(long fh, Object buf, long[] stat) * @param buf buffer * @param count number of items in buffer * @param type datatype of each buffer element - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void readAllBegin(Object buf, int count, Datatype type) throws MPIException @@ -1079,7 +1079,7 @@ private native void readAllBegin(long fh, Object buf, int count, long type) * Java binding of {@code MPI_FILE_READ_ALL_END}. * @param buf buffer * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status readAllEnd(Object buf) throws MPIException { @@ -1105,7 +1105,7 @@ private native void readAllEnd(long fh, Object buf, long[] stat) * @param buf buffer * @param count number of items in buffer * @param type datatype of each buffer element - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void writeAllBegin(Object buf, int count, Datatype type) throws MPIException @@ -1141,7 +1141,7 @@ private native void writeAllBegin(long fh, Object buf, int count, long type) * Java binding of {@code MPI_FILE_WRITE_ALL_END}. * @param buf buffer * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status writeAllEnd(Object buf) throws MPIException { @@ -1167,7 +1167,7 @@ private native void writeAllEnd(long fh, Object buf, long[] stat) * @param buf buffer * @param count number of items in buffer * @param type datatype of each buffer element - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void readOrderedBegin(Object buf, int count, Datatype type) throws MPIException @@ -1203,7 +1203,7 @@ private native void readOrderedBegin(long fh, Object buf, int count, long type) * Java binding of {@code MPI_FILE_READ_ORDERED_END}. * @param buf buffer * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status readOrderedEnd(Object buf) throws MPIException { @@ -1229,7 +1229,7 @@ private native void readOrderedEnd(long fh, Object buf, long[] stat) * @param buf buffer * @param count number of items in buffer * @param type datatype of each buffer element - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void writeOrderedBegin(Object buf, int count, Datatype type) throws MPIException @@ -1265,7 +1265,7 @@ private native void writeOrderedBegin(long fh, Object buf, int count, long type) * Java binding of {@code MPI_FILE_WRITE_ORDERED_END}. * @param buf buffer * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status writeOrderedEnd(Object buf) throws MPIException { @@ -1297,7 +1297,7 @@ private Status getBeginStatus() * Java binding of {@code MPI_FILE_GET_TYPE_EXTENT}. * @param type type of data * @return datatype extent - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getTypeExtent(Datatype type) throws MPIException { @@ -1310,7 +1310,7 @@ public int getTypeExtent(Datatype type) throws MPIException /** * Java binding of {@code MPI_FILE_SET_ATOMICITY}. * @param atomicity true to set atomic mode, false to set nonatomic mode - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setAtomicity(boolean atomicity) throws MPIException { @@ -1324,7 +1324,7 @@ private native void setAtomicity(long fh, boolean atomicity) /** * Java binding of {@code MPI_FILE_GET_ATOMICITY}. * @return current consistency of the file - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public boolean getAtomicity() throws MPIException { @@ -1336,7 +1336,7 @@ public boolean getAtomicity() throws MPIException /** * Java binding of {@code MPI_FILE_SYNC}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void sync() throws MPIException { @@ -1349,7 +1349,7 @@ public void sync() throws MPIException /** * Java binding of the MPI operation {@code MPI_FILE_SET_ERRHANDLER}. * @param errhandler new MPI error handler for file - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setErrhandler(Errhandler errhandler) throws MPIException { @@ -1363,7 +1363,7 @@ private native void setErrhandler(long fh, long errhandler) /** * Java binding of the MPI operation {@code MPI_FILE_GET_ERRHANDLER}. * @return MPI error handler currently associated with file - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Errhandler getErrhandler() throws MPIException { @@ -1376,7 +1376,7 @@ public Errhandler getErrhandler() throws MPIException /** * Java binding of the MPI operation {@code MPI_FILE_CALL_ERRHANDLER}. * @param errorCode error code - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void callErrhandler(int errorCode) throws MPIException { diff --git a/ompi/mpi/java/java/Freeable.java b/ompi/mpi/java/java/Freeable.java index 9ec8a4571d4..bca1dbb2db8 100644 --- a/ompi/mpi/java/java/Freeable.java +++ b/ompi/mpi/java/java/Freeable.java @@ -52,7 +52,7 @@ public interface Freeable { /** * Frees a freeable object. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ void free() throws MPIException; } diff --git a/ompi/mpi/java/java/GraphComm.java b/ompi/mpi/java/java/GraphComm.java index fe050166962..29adbee930e 100644 --- a/ompi/mpi/java/java/GraphComm.java +++ b/ompi/mpi/java/java/GraphComm.java @@ -93,7 +93,7 @@ protected GraphComm(long[] commRequest) * Duplicates this communicator. *

Java binding of {@code MPI_COMM_DUP}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public GraphComm dup() throws MPIException { @@ -107,7 +107,7 @@ protected GraphComm(long[] commRequest) * The request object must be obtained calling {@link #getRequest}. *

Java binding of {@code MPI_COMM_IDUP}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public GraphComm iDup() throws MPIException { @@ -120,7 +120,7 @@ protected GraphComm(long[] commRequest) *

Java binding of {@code MPI_COMM_DUP_WITH_INFO}. * @param info info object to associate with the new communicator * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public GraphComm dupWithInfo(Info info) throws MPIException { @@ -136,7 +136,7 @@ protected GraphComm(long[] commRequest) * from the sizes of the {@code index} and {@code edges} fields * of the returned object. * @return object defining node degress and edges of graph - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public GraphParms getDims() throws MPIException { @@ -153,7 +153,7 @@ public GraphParms getDims() throws MPIException *

The number of neighbors can be extracted from the size of the result. * @param rank rank of a process in the group of this communicator * @return array of ranks of neighboring processes to one specified - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int[] getNeighbors(int rank) throws MPIException { @@ -166,7 +166,7 @@ public int[] getNeighbors(int rank) throws MPIException /** * Gets the adjacency information for a distributed graph topology. * @return adjacency information for a distributed graph topology - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public DistGraphNeighbors getDistGraphNeighbors() throws MPIException { @@ -184,7 +184,7 @@ private native DistGraphNeighbors getDistGraphNeighbors(long comm) * @param index node degrees * @param edges graph edges * @return reordered rank of calling process - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int map(int[] index, int[] edges) throws MPIException { diff --git a/ompi/mpi/java/java/Group.java b/ompi/mpi/java/java/Group.java index 7f5d505b5c3..3af4cec3299 100644 --- a/ompi/mpi/java/java/Group.java +++ b/ompi/mpi/java/java/Group.java @@ -72,7 +72,7 @@ protected Group(long handle) /** * Java binding of the MPI operation {@code MPI_GROUP_SIZE}. * @return number of processes in the group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getSize() throws MPIException { @@ -87,7 +87,7 @@ public int getSize() throws MPIException *

Java binding of the MPI operation {@code MPI_GROUP_RANK}. * @return rank of this process in the group, or {@code MPI.UNDEFINED} * if this process is not a member of the group. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getRank() throws MPIException { @@ -125,7 +125,7 @@ public boolean isNull() * @param ranks1 array of valid ranks in group1 * @param group2 another group * @return array of corresponding ranks in group2 - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int[] translateRanks(Group group1, int[] ranks1, Group group2) throws MPIException @@ -145,7 +145,7 @@ private static native int[] translateRanks( * @return {@code MPI.IDENT} if the group members and group order are exactly * the same in both groups, {@code MPI.SIMILAR} if the group members are * the same but the order is different, {@code MPI.UNEQUAL} otherwise. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int compare(Group group1, Group group2) throws MPIException { @@ -161,7 +161,7 @@ public static int compare(Group group1, Group group2) throws MPIException * @param group1 first group * @param group2 second group * @return union group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Group union(Group group1, Group group2) throws MPIException { @@ -177,7 +177,7 @@ public static Group union(Group group1, Group group2) throws MPIException * @param group1 first group * @param group2 second group * @return intersection group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Group intersection(Group group1, Group group2) throws MPIException { @@ -193,7 +193,7 @@ public static Group intersection(Group group1, Group group2) throws MPIException * @param group1 first group * @param group2 second group * @return difference group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Group difference(Group group1, Group group2) throws MPIException { @@ -208,7 +208,7 @@ public static Group difference(Group group1, Group group2) throws MPIException *

Java binding of the MPI operation {@code MPI_GROUP_INCL}. * @param ranks ranks from this group to appear in new group * @return new group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Group incl(int[] ranks) throws MPIException { @@ -223,7 +223,7 @@ public Group incl(int[] ranks) throws MPIException *

Java binding of the MPI operation {@code MPI_GROUP_EXCL}. * @param ranks ranks from this group not to appear in new group * @return new group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Group excl(int[] ranks) throws MPIException { @@ -243,7 +243,7 @@ public Group excl(int[] ranks) throws MPIException * of triplets. The size of the second dimension is 3. * @param ranges array of integer triplets * @return new group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Group rangeIncl(int[][] ranges) throws MPIException { @@ -261,7 +261,7 @@ public Group rangeIncl(int[][] ranges) throws MPIException * indicating ranks in this group to be excluded from the new group. * @param ranges array of integer triplets * @return new group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Group rangeExcl(int[][] ranges) throws MPIException { diff --git a/ompi/mpi/java/java/Info.java b/ompi/mpi/java/java/Info.java index ba3bb3a54e8..0579f123868 100644 --- a/ompi/mpi/java/java/Info.java +++ b/ompi/mpi/java/java/Info.java @@ -31,7 +31,7 @@ public final class Info implements Freeable, Cloneable /** * Java binding of the MPI operation {@code MPI_INFO_CREATE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Info() throws MPIException { @@ -58,7 +58,7 @@ protected static Info newEnv() * Java binding of the MPI operation {@code MPI_INFO_SET}. * @param key key * @param value value - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void set(String key, String value) throws MPIException { @@ -73,7 +73,7 @@ private native void set(long handle, String key, String value) * Java binding of the MPI operation {@code MPI_INFO_GET}. * @param key key * @return value or {@code null} if key is not defined - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public String get(String key) throws MPIException { @@ -86,7 +86,7 @@ public String get(String key) throws MPIException /** * Java binding of the MPI operation {@code MPI_INFO_DELETE}. * @param key key - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void delete(String key) throws MPIException { @@ -99,7 +99,7 @@ public void delete(String key) throws MPIException /** * Java binding of the MPI operation {@code MPI_INFO_GET_NKEYS}. * @return number of defined keys - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int size() throws MPIException { @@ -113,7 +113,7 @@ public int size() throws MPIException * Java binding of the MPI operation {@code MPI_INFO_GET_NTHKEY}. * @param i key number * @return key - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public String getKey(int i) throws MPIException { @@ -144,7 +144,7 @@ public String getKey(int i) throws MPIException /** * Java binding of the MPI operation {@code MPI_INFO_DUP}. * @return info object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Info dup() throws MPIException { @@ -156,7 +156,7 @@ public Info dup() throws MPIException /** * Java binding of the MPI operation {@code MPI_INFO_FREE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public void free() throws MPIException { diff --git a/ompi/mpi/java/java/Intercomm.java b/ompi/mpi/java/java/Intercomm.java index e5a52f00023..17ee1bf08ed 100644 --- a/ompi/mpi/java/java/Intercomm.java +++ b/ompi/mpi/java/java/Intercomm.java @@ -85,7 +85,7 @@ protected Intercomm(long[] commRequest) * Duplicates this communicator. *

Java binding of {@code MPI_COMM_DUP}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public Intercomm dup() throws MPIException { @@ -99,7 +99,7 @@ protected Intercomm(long[] commRequest) *

The new communicator can't be used before the operation completes. * The request object must be obtained calling {@link #getRequest}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public Intercomm iDup() throws MPIException { @@ -112,7 +112,7 @@ protected Intercomm(long[] commRequest) *

Java binding of {@code MPI_COMM_DUP_WITH_INFO}. * @param info info object to associate with the new communicator * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public Intercomm dupWithInfo(Info info) throws MPIException { @@ -126,7 +126,7 @@ protected Intercomm(long[] commRequest) * Size of remote group. *

Java binding of the MPI operation {@code MPI_COMM_REMOTE_SIZE}. * @return number of process in remote group of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getRemoteSize() throws MPIException { @@ -140,7 +140,7 @@ public int getRemoteSize() throws MPIException * Return the remote group. *

Java binding of the MPI operation {@code MPI_COMM_REMOTE_GROUP}. * @return remote group of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Group getRemoteGroup() throws MPIException { @@ -155,7 +155,7 @@ public Group getRemoteGroup() throws MPIException *

Java binding of the MPI operation {@code MPI_INTERCOMM_MERGE}. * @param high true if the local group has higher ranks in combined group * @return new intra-communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Intracomm merge(boolean high) throws MPIException { @@ -168,7 +168,7 @@ public Intracomm merge(boolean high) throws MPIException /** * Java binding of {@code MPI_COMM_GET_PARENT}. * @return the parent communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Intercomm getParent() throws MPIException { diff --git a/ompi/mpi/java/java/Intracomm.java b/ompi/mpi/java/java/Intracomm.java index 1c90a7bdfd2..b19ca5415f5 100644 --- a/ompi/mpi/java/java/Intracomm.java +++ b/ompi/mpi/java/java/Intracomm.java @@ -103,7 +103,7 @@ protected Intracomm(long[] commRequest) * Duplicates this communicator. *

Java binding of {@code MPI_COMM_DUP}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public Intracomm dup() throws MPIException { @@ -117,7 +117,7 @@ protected Intracomm(long[] commRequest) *

The new communicator can't be used before the operation completes. * The request object must be obtained calling {@link #getRequest}. * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public Intracomm iDup() throws MPIException { @@ -130,7 +130,7 @@ protected Intracomm(long[] commRequest) *

Java binding of {@code MPI_COMM_DUP_WITH_INFO}. * @param info info object to associate with the new communicator * @return copy of this communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public Intracomm dupWithInfo(Info info) throws MPIException { @@ -145,7 +145,7 @@ protected Intracomm(long[] commRequest) * @param colour control of subset assignment * @param key control of rank assignment * @return new communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intracomm split(int colour, int key) throws MPIException { @@ -163,7 +163,7 @@ public final Intracomm split(int colour, int key) throws MPIException * @param key control of rank assignment * @param info info argument * @return new communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intracomm splitType(int splitType, int key, Info info) throws MPIException { @@ -178,7 +178,7 @@ public final Intracomm splitType(int splitType, int key, Info info) throws MPIEx *

Java binding of the MPI operation {@code MPI_COMM_CREATE}. * @param group group which is a subset of the group of this communicator * @return new communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intracomm create(Group group) throws MPIException { @@ -194,7 +194,7 @@ public final Intracomm create(Group group) throws MPIException * @param group group which is a subset of the group of this communicator * @param tag an integer tag * @return new communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intracomm createGroup(Group group, int tag) throws MPIException { @@ -221,7 +221,7 @@ public final Intracomm createGroup(Group group, int tag) throws MPIException * @param reorder {@code true} if ranking may be reordered, * {@code false} if not * @return new cartesian topology communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final CartComm createCart(int[] dims, boolean[] periods, boolean reorder) throws MPIException @@ -244,7 +244,7 @@ private native long createCart( * @param reorder {@code true} if ranking may be reordered, * {@code false} if not * @return new graph topology communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final GraphComm createGraph(int[] index, int[] edges, boolean reorder) throws MPIException @@ -269,7 +269,7 @@ private native long createGraph( * @param info hints on optimization and interpretation of weights * @param reorder the process may be reordered (true) or not (false) * @return communicator with distributed graph topology - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final GraphComm createDistGraph( int[] sources, int[] degrees, int[] destinations, @@ -295,7 +295,7 @@ public final GraphComm createDistGraph( * @param info hints on optimization and interpretation of weights * @param reorder the process may be reordered (true) or not (false) * @return communicator with distributed graph topology - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final GraphComm createDistGraph( int[] sources, int[] degrees, int[] destinations, @@ -330,7 +330,7 @@ private native long createDistGraph( * @param info hints on optimization and interpretation of weights * @param reorder the process may be reordered (true) or not (false) * @return communicator with distributed graph topology - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final GraphComm createDistGraphAdjacent( int[] sources, int[] sourceWeights, @@ -358,7 +358,7 @@ public final GraphComm createDistGraphAdjacent( * @param info hints on optimization and interpretation of weights * @param reorder the process may be reordered (true) or not (false) * @return communicator with distributed graph topology - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final GraphComm createDistGraphAdjacent( int[] sources, int[] destinations, Info info, boolean reorder) @@ -385,7 +385,7 @@ private native long createDistGraphAdjacent( * @param count number of items in input buffer * @param type data type of each item in input buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void scan(Object sendbuf, Object recvbuf, int count, Datatype type, Op op) @@ -425,7 +425,7 @@ public final void scan(Object sendbuf, Object recvbuf, * @param count number of items in input buffer * @param type data type of each item in input buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void scan(Object recvbuf, int count, Datatype type, Op op) throws MPIException @@ -460,7 +460,7 @@ private native void scan( * @param type data type of each item in input buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iScan(Buffer sendbuf, Buffer recvbuf, int count, Datatype type, Op op) @@ -485,7 +485,7 @@ public final Request iScan(Buffer sendbuf, Buffer recvbuf, * @param type data type of each item in buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iScan(Buffer buf, int count, Datatype type, Op op) throws MPIException @@ -512,7 +512,7 @@ private native long iScan( * @param count number of items in input buffer * @param type data type of each item in input buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void exScan(Object sendbuf, Object recvbuf, int count, Datatype type, Op op) @@ -552,7 +552,7 @@ public final void exScan(Object sendbuf, Object recvbuf, * @param count number of items in input buffer * @param type data type of each item in input buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void exScan(Object buf, int count, Datatype type, Op op) throws MPIException @@ -587,7 +587,7 @@ private native void exScan( * @param type data type of each item in input buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iExScan(Buffer sendbuf, Buffer recvbuf, int count, Datatype type, Op op) @@ -612,7 +612,7 @@ public final Request iExScan(Buffer sendbuf, Buffer recvbuf, * @param type data type of each item in input buffer * @param op reduce operation * @return communication request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request iExScan(Buffer buf, int count, Datatype type, Op op) throws MPIException @@ -634,7 +634,7 @@ private native long iExScan( /** * Java binding of {@code MPI_OPEN_PORT} using {@code MPI_INFO_NULL}. * @return port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static String openPort() throws MPIException { @@ -646,7 +646,7 @@ public static String openPort() throws MPIException * Java binding of {@code MPI_OPEN_PORT}. * @param info implementation-specific information * @return port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static String openPort(Info info) throws MPIException { @@ -659,7 +659,7 @@ public static String openPort(Info info) throws MPIException /** * Java binding of {@code MPI_CLOSE_PORT}. * @param name port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void closePort(String name) throws MPIException { @@ -674,7 +674,7 @@ public static void closePort(String name) throws MPIException * @param port port name * @param root rank in comm of root node * @return intercommunicator with client as remote group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intercomm accept(String port, int root) throws MPIException { @@ -688,7 +688,7 @@ public final Intercomm accept(String port, int root) throws MPIException * @param info implementation-specific information * @param root rank in comm of root node * @return intercommunicator with client as remote group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intercomm accept(String port, Info info, int root) throws MPIException @@ -705,7 +705,7 @@ private native long accept(long comm, String port, long info, int root) * @param port port name * @param root rank in comm of root node * @return intercommunicator with server as remote group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intercomm connect(String port, int root) throws MPIException { @@ -719,7 +719,7 @@ public final Intercomm connect(String port, int root) throws MPIException * @param info implementation-specific information * @param root rank in comm of root node * @return intercommunicator with server as remote group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intercomm connect(String port, Info info, int root) throws MPIException @@ -735,7 +735,7 @@ private native long connect(long comm, String port, long info, int root) * Java binding of {@code MPI_PUBLISH_NAME} using {@code MPI_INFO_NULL}. * @param service service name * @param port port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void publishName(String service, String port) throws MPIException @@ -749,7 +749,7 @@ public static void publishName(String service, String port) * @param service service name * @param info implementation-specific information * @param port port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void publishName(String service, Info info, String port) throws MPIException @@ -765,7 +765,7 @@ private native static void publishName(String service, long info, String port) * Java binding of {@code MPI_UNPUBLISH_NAME} using {@code MPI_INFO_NULL}. * @param service service name * @param port port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void unpublishName(String service, String port) throws MPIException @@ -779,7 +779,7 @@ public static void unpublishName(String service, String port) * @param service service name * @param info implementation-specific information * @param port port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void unpublishName(String service, Info info, String port) throws MPIException @@ -795,7 +795,7 @@ private native static void unpublishName(String service, long info, String port) * Java binding of {@code MPI_LOOKUP_NAME} using {@code MPI_INFO_NULL}. * @param service service name * @return port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static String lookupName(String service) throws MPIException { @@ -808,7 +808,7 @@ public static String lookupName(String service) throws MPIException * @param service service name * @param info implementation-specific information * @return port name - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static String lookupName(String service, Info info) throws MPIException { @@ -832,7 +832,7 @@ private native static String lookupName(String service, long info) * @param errcodes one code per process; if this parameter is null, * {@code MPI_ERRCODES_IGNORE} will be used. * @return intercommunicator between original group and the newly spawned group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intercomm spawn(String command, String[] argv, int maxprocs, Info info, int root, int[] errcodes) @@ -861,7 +861,7 @@ private native long spawn(long comm, String command, String[] argv, * @param errcodes one code per process; if this parameter is null, * {@code MPI_ERRCODES_IGNORE} will be used. * @return intercommunicator between original group and the newly spawned group - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Intercomm spawnMultiple( String[] commands, String[][] argv, int[] maxprocs, diff --git a/ompi/mpi/java/java/MPI.java b/ompi/mpi/java/java/MPI.java index 3764cf340d3..9b253d633a6 100644 --- a/ompi/mpi/java/java/MPI.java +++ b/ompi/mpi/java/java/MPI.java @@ -441,7 +441,7 @@ private static void initCommon() throws MPIException *

Java binding of the MPI operation {@code MPI_INIT}. * @param args arguments to the {@code main} method. * @return arguments - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static String[] Init(String[] args) throws MPIException { @@ -461,7 +461,7 @@ public static String[] Init(String[] args) throws MPIException * @param args arguments to the {@code main} method. * @param required desired level of thread support * @return provided level of thread support - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int InitThread(String[] args, int required) throws MPIException { @@ -479,7 +479,7 @@ private static native int InitThread_jni(String[] args, int required) /** * Java binding of the MPI operation {@code MPI_QUERY_THREAD}. * @return provided level of thread support - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int queryThread() throws MPIException { @@ -492,7 +492,7 @@ public static int queryThread() throws MPIException /** * Java binding of the MPI operation {@code MPI_IS_THREAD_MAIN}. * @return true if it is the main thread - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static boolean isThreadMain() throws MPIException { @@ -505,7 +505,7 @@ public static boolean isThreadMain() throws MPIException /** * Finalize MPI. *

Java binding of the MPI operation {@code MPI_FINALIZE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void Finalize() throws MPIException { @@ -520,7 +520,7 @@ public static void Finalize() throws MPIException * Returns an elapsed time on the calling processor. *

Java binding of the MPI operation {@code MPI_WTIME}. * @return time in seconds since an arbitrary time in the past. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static double wtime() throws MPIException { @@ -534,7 +534,7 @@ public static double wtime() throws MPIException * Returns resolution of timer. *

Java binding of the MPI operation {@code MPI_WTICK}. * @return resolution of {@code wtime} in seconds. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static double wtick() throws MPIException { @@ -570,7 +570,7 @@ public static String getLibVersion() { * Returns the name of the processor on which it is called. *

Java binding of the MPI operation {@code MPI_GET_PROCESSOR_NAME}. * @return A unique specifier for the actual node. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ static public String getProcessorName() throws MPIException { @@ -587,7 +587,7 @@ static public String getProcessorName() throws MPIException *

Java binding of the MPI operation {@code MPI_INITIALIZED}. * @return {@code true} if {@code Init} has been called, * {@code false} otherwise. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ static public native boolean isInitialized() throws MPIException; @@ -596,7 +596,7 @@ static public String getProcessorName() throws MPIException *

Java binding of the MPI operation {@code MPI_FINALIZED}. * @return {@code true} if {@code Finalize} has been called, * {@code false} otherwise. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ static public native boolean isFinalized() throws MPIException; @@ -604,7 +604,7 @@ static public String getProcessorName() throws MPIException * Attaches a user-provided buffer for sending. *

Java binding of the MPI operation {@code MPI_BUFFER_ATTACH}. * @param buffer initial buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ static public void attachBuffer(byte[] buffer) throws MPIException { @@ -619,7 +619,7 @@ static public void attachBuffer(byte[] buffer) throws MPIException * Removes an existing buffer (for use in sending). *

Java binding of the MPI operation {@code MPI_BUFFER_DETACH}. * @return initial buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ static public byte[] detachBuffer() throws MPIException { @@ -646,7 +646,7 @@ public static void pControl(int level, Object obj) /** * Check if MPI has been initialized and hasn't been finalized. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ protected static void check() throws MPIException { diff --git a/ompi/mpi/java/java/MPIException.java b/ompi/mpi/java/java/MPIException.java index 24ec52f9074..01cba6e90a2 100644 --- a/ompi/mpi/java/java/MPIException.java +++ b/ompi/mpi/java/java/MPIException.java @@ -43,12 +43,15 @@ * Updated : $Date: 1999/09/14 22:01:52 $ * Copyright: Northeast Parallel Architectures Center * at Syracuse University 1999 + * + * Sidenote from August 2020: this class probably should have been + * called MPIError, not MPIException. */ package mpi; /** - * Signals that an MPI exception of some sort has occurred. + * Signals that an MPI error of some sort has occurred. *

The Java binding of the MPI operation {@code MPI_Error_string} is the * method {@code getMessage}, which is inherited from the class Exception. */ @@ -65,7 +68,7 @@ protected MPIException(int code, int clazz, String message) /** * Creates an exception. - * @param message message associated to the exception + * @param message message associated to the error */ public MPIException(String message) { @@ -74,7 +77,7 @@ public MPIException(String message) /** * Creates an exception: - * @param cause cause associated to the exception + * @param cause cause associated to the error */ public MPIException(Throwable cause) { diff --git a/ompi/mpi/java/java/Message.java b/ompi/mpi/java/java/Message.java index 9946a671294..1414185cc99 100644 --- a/ompi/mpi/java/java/Message.java +++ b/ompi/mpi/java/java/Message.java @@ -78,7 +78,7 @@ public boolean isNoProc() * @param tag message tag * @param comm communicator * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status mProbe(int source, int tag, Comm comm) throws MPIException { @@ -97,7 +97,7 @@ private native long mProbe(int source, int tag, long comm, long[] status) * @param tag message tag * @param comm communicator * @return status object if there is a message, {@code null} otherwise - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status imProbe(int source, int tag, Comm comm) throws MPIException { @@ -114,7 +114,7 @@ private native Status imProbe(int source, int tag, long comm) * @param count number of elements in receve buffer * @param type datatype of each receive buffer element * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Status mRecv(Object buf, int count, Datatype type) throws MPIException { @@ -145,7 +145,7 @@ private native long mRecv( * @param count number of elements in receve buffer * @param type datatype of each receive buffer element * @return request object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request imRecv(Buffer buf, int count, Datatype type) throws MPIException diff --git a/ompi/mpi/java/java/Op.java b/ompi/mpi/java/java/Op.java index a10559825b2..fb4fc032b69 100644 --- a/ompi/mpi/java/java/Op.java +++ b/ompi/mpi/java/java/Op.java @@ -121,7 +121,7 @@ public boolean isCommutative() /** * Java binding of the MPI operation {@code MPI_OP_FREE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public native void free() throws MPIException; diff --git a/ompi/mpi/java/java/Prequest.java b/ompi/mpi/java/java/Prequest.java index 94b36978392..4cbc9decf01 100644 --- a/ompi/mpi/java/java/Prequest.java +++ b/ompi/mpi/java/java/Prequest.java @@ -68,7 +68,7 @@ protected Prequest(long handle) * one of the {@code wait} or {@code test} operations. * On successful completion the request becomes inactive again. * It can be reactivated by a further call to {@code Start}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void start() throws MPIException { @@ -81,7 +81,7 @@ public void start() throws MPIException * Activate a list of communication requests. *

Java binding of the MPI operation {@code MPI_STARTALL}. * @param requests array of requests - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void startAll(Prequest[] requests) throws MPIException { diff --git a/ompi/mpi/java/java/Request.java b/ompi/mpi/java/java/Request.java index 6459f812701..962e12f7912 100644 --- a/ompi/mpi/java/java/Request.java +++ b/ompi/mpi/java/java/Request.java @@ -107,7 +107,7 @@ protected Request(long handle) /** * Mark a pending nonblocking communication for cancellation. * Java binding of the MPI operation {@code MPI_CANCEL}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void cancel() throws MPIException { @@ -157,7 +157,7 @@ public final boolean isNull() *

Java binding of the MPI operation {@code MPI_WAIT}. *

After the call returns, the request object becomes inactive. * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Status waitStatus() throws MPIException { @@ -173,7 +173,7 @@ public final Status waitStatus() throws MPIException * Blocks until the operation identified by the request is complete. *

Java binding of the MPI operation {@code MPI_WAIT}. *

After the call returns, the request object becomes inactive. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final void waitFor() throws MPIException { @@ -190,7 +190,7 @@ public final void waitFor() throws MPIException *

After the call, if the operation is complete (ie, if the return * value is non-null), the request object becomes inactive. * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Status testStatus() throws MPIException { @@ -207,7 +207,7 @@ public final Status testStatus() throws MPIException *

After the call, if the operation is complete (ie, if the return * value is non-null), the request object remains active. * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Status getStatus() throws MPIException { @@ -224,7 +224,7 @@ public final Status getStatus() throws MPIException *

After the call, if the operation is complete (ie, if the return * value is true), the request object becomes inactive. * @return true if the operation identified by the request, false otherwise - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final boolean test() throws MPIException { @@ -244,7 +244,7 @@ public final boolean test() throws MPIException * of array of {@code requests} becomes inactive. * @param requests array of requests * @return status object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Status waitAnyStatus(Request[] requests) throws MPIException { @@ -268,7 +268,7 @@ private static native void waitAnyStatus(long[] requests, long[] status) * @return The index in array of {@code requests} for the request that * completed. If all of the requests are MPI_REQUEST_NULL, then index * is returned as {@code MPI.UNDEFINED}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int waitAny(Request[] requests) throws MPIException { @@ -291,7 +291,7 @@ public static int waitAny(Request[] requests) throws MPIException * If no request completed, {@code testAnyStatus} returns {@code null}. * @param requests array of requests * @return status object if one request completed, {@code null} otherwise. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Status testAnyStatus(Request[] requests) throws MPIException { @@ -312,7 +312,7 @@ public static Status testAnyStatus(Request[] requests) throws MPIException * @param requests array of requests * @return index of operation that completed, or {@code MPI.UNDEFINED} * if none completed. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int testAny(Request[] requests) throws MPIException { @@ -334,7 +334,7 @@ public static int testAny(Request[] requests) throws MPIException * elements of the status array will contain null status references. * @param requests array of requests * @return array of statuses - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Status[] waitAllStatus(Request[] requests) throws MPIException { @@ -353,7 +353,7 @@ private static native Status[] waitAllStatus(long[] requests) * requests in the array have completed. *

Java binding of the MPI operation {@code MPI_WAITALL}. * @param requests array of requests - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void waitAll(Request[] requests) throws MPIException { @@ -374,7 +374,7 @@ public static void waitAll(Request[] requests) throws MPIException * @param requests array of requests * @return array of statuses if all operations have completed, * {@code null} otherwise. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Status[] testAllStatus(Request[] requests) throws MPIException { @@ -395,7 +395,7 @@ private static native Status[] testAllStatus(long[] requests) * @param requests array of requests * @return {@code true} if all operations have completed, * {@code false} otherwise. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static boolean testAll(Request[] requests) throws MPIException { @@ -420,7 +420,7 @@ public static boolean testAll(Request[] requests) throws MPIException * @param requests array of requests * @return array of statuses or {@code null} if the number of operations * completed is {@code MPI_UNDEFINED}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Status[] waitSomeStatus(Request[] requests) throws MPIException { @@ -444,7 +444,7 @@ private static native Status[] waitSomeStatus(long[] requests) * @param requests array of requests * @return array of indexes of {@code requests} that completed or {@code null} * if the number of operations completed is {@code MPI_UNDEFINED}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int[] waitSome(Request[] requests) throws MPIException { @@ -464,7 +464,7 @@ public static int[] waitSome(Request[] requests) throws MPIException * length zero, otherwise the return value are as for {@code waitSome}. * @param requests array of requests * @return array of statuses - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static Status[] testSomeStatus(Request[] requests) throws MPIException { @@ -485,7 +485,7 @@ private static native Status[] testSomeStatus(long[] requests) * length zero, otherwise the return value are as for {@code waitSome}. * @param requests array of requests * @return array of indexes of {@code requests} that completed. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int[] testSome(Request[] requests) throws MPIException { diff --git a/ompi/mpi/java/java/Status.java b/ompi/mpi/java/java/Status.java index 977542b69f9..6506b132413 100644 --- a/ompi/mpi/java/java/Status.java +++ b/ompi/mpi/java/java/Status.java @@ -74,7 +74,7 @@ protected Status() *

Java binding of the MPI operation {@code MPI_GET_COUNT}. * @param datatype datatype of each item in receive buffer * @return number of received entries - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getCount(Datatype datatype) throws MPIException { @@ -96,7 +96,7 @@ private native int getCount( * Tests if the communication was cancelled. *

Java binding of the MPI operation {@code MPI_TEST_CANCELLED}. * @return true if the operation was succesfully cancelled, false otherwise - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public boolean isCancelled() throws MPIException { @@ -119,7 +119,7 @@ private native boolean isCancelled( *

Java binding of the MPI operation {@code MPI_GET_ELEMENTS}. * @param datatype datatype used by receive operation * @return number of received basic elements - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public int getElements(Datatype datatype) throws MPIException { @@ -142,7 +142,7 @@ private native int getElements( *

Java binding of the MPI operation {@code MPI_GET_ELEMENTS_X}. * @param datatype datatype used by receive operation * @return number of received basic elements - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Count getElementsX(Datatype datatype) throws MPIException { @@ -165,7 +165,7 @@ private native Count getElementsX( *

Java binding of the MPI operation {@code MPI_STATUS_SET_ELEMENTS}. * @param datatype datatype used by receive operation * @param count number of elements to associate with the status - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setElements(Datatype datatype, int count) throws MPIException { @@ -188,7 +188,7 @@ private native int setElements( *

Java binding of the MPI operation {@code MPI_STATUS_SET_ELEMENTS_X}. * @param datatype datatype used by receive operation * @param count number of elements to associate with the status - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setElementsX(Datatype datatype, Count count) throws MPIException { @@ -210,7 +210,7 @@ private native long setElementsX( * Sets the cancelled flag. *

Java binding of the MPI operation {@code MPI_STATUS_SET_CANCELLED}. * @param flag if true indicates request was cancelled - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setCancelled(boolean flag) throws MPIException { diff --git a/ompi/mpi/java/java/Struct.java b/ompi/mpi/java/java/Struct.java index b7dfefe4d4b..95e45db6bd8 100644 --- a/ompi/mpi/java/java/Struct.java +++ b/ompi/mpi/java/java/Struct.java @@ -66,7 +66,7 @@ private void createStruct() throws MPIException /** * Returns the extent of the struct data type. * @return Extent of the struct data type. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int getExtent() throws MPIException { @@ -77,7 +77,7 @@ public final int getExtent() throws MPIException /** * Returns the data type of the struct. * @return The data type of the struct. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Datatype getType() throws MPIException { @@ -105,7 +105,7 @@ private T newData(ByteBuffer buffer, int offset) * Gets a Data object in order to access to the buffer. * @param buffer the Data object will read/write on this buffer. * @return Data object - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final T getData(ByteBuffer buffer) throws MPIException { @@ -120,7 +120,7 @@ public final T getData(ByteBuffer buffer) throws MPIException * @param buffer The Data object will read/write on this buffer. * @param index Index of the struct in the buffer. * @return Data object. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final T getData(ByteBuffer buffer, int index) throws MPIException @@ -134,7 +134,7 @@ public final T getData(ByteBuffer buffer, int index) * Gets a Data object in order to access to the byte array. * @param array The Data object will read/write on this byte array. * @return Data object. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final T getData(byte[] array) throws MPIException { @@ -150,7 +150,7 @@ public final T getData(byte[] array) throws MPIException * @param array The Data object will read/write on this byte array. * @param index Index of the struct in the array. * @return Data object. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final T getData(byte[] array, int index) throws MPIException @@ -329,7 +329,7 @@ public final int addDouble(int length) * Adds a struct field to this struct. * @param struct Type of the field. * @return Offset of the new field. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int addStruct(Struct struct) throws MPIException { @@ -341,7 +341,7 @@ public final int addStruct(Struct struct) throws MPIException * @param struct Type of the array. * @param length Length of the array. * @return Offset of the new field. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int addStruct(Struct struct, int length) throws MPIException { @@ -353,7 +353,7 @@ public final int addStruct(Struct struct, int length) throws MPIException * Adds a field of the specified data type. * @param type Data type. * @return Offset of the new field. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int addData(Datatype type) throws MPIException { @@ -365,7 +365,7 @@ public final int addData(Datatype type) throws MPIException * @param type Data type. * @param length Length of the array. * @return Offset of the new field. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final int addData(Datatype type, int length) throws MPIException { @@ -784,7 +784,7 @@ protected final ByteBuffer getBuffer(Datatype type, int field) * @param field Offset of the buffer array. * @param index Index of the buffer in the array. * @return Buffer object. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ protected final ByteBuffer getBuffer(Datatype type, int field, int index) throws MPIException diff --git a/ompi/mpi/java/java/UserFunction.java b/ompi/mpi/java/java/UserFunction.java index 13a98d67c17..785fabc98a2 100644 --- a/ompi/mpi/java/java/UserFunction.java +++ b/ompi/mpi/java/java/UserFunction.java @@ -60,7 +60,7 @@ public abstract class UserFunction * @param inOutVec in-out array of accumulator locations * @param count number of items in arrays * @param datatype type of each item - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void call(Object inVec, Object inOutVec, int count, Datatype datatype) throws MPIException @@ -74,7 +74,7 @@ public void call(Object inVec, Object inOutVec, int count, Datatype datatype) * @param inOut in-out direct byte buffer of accumulator locations * @param count number of items in buffers * @param datatype type of each item - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void call(ByteBuffer in, ByteBuffer inOut, int count, Datatype datatype) throws MPIException diff --git a/ompi/mpi/java/java/Win.java b/ompi/mpi/java/java/Win.java index d3a7d7c1682..e9102f36c91 100644 --- a/ompi/mpi/java/java/Win.java +++ b/ompi/mpi/java/java/Win.java @@ -42,7 +42,7 @@ public final class Win implements Freeable * @param dispUnit local unit size for displacements (buffer elements) * @param info info object * @param comm communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Win(Buffer base, int size, int dispUnit, Info info, Comm comm) throws MPIException @@ -81,7 +81,7 @@ private native long createWin( * @param comm communicator * @param base initial address of window * @param flavor FLAVOR_PRIVATE or FLAVOR_SHARED - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Win(int size, int dispUnit, Info info, Comm comm, Buffer base, int flavor) throws MPIException @@ -124,7 +124,7 @@ private native long allocateSharedWin( * Java binding of {@code MPI_WIN_CREATE_DYNAMIC}. * @param info info object * @param comm communicator - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Win(Info info, Comm comm) throws MPIException @@ -154,7 +154,7 @@ private int getBaseType(Datatype orgType, Datatype targetType) * Java binding of {@code MPI_WIN_ATTACH}. * @param base initial address of window * @param size size of window (buffer elements) - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void attach(Buffer base, int size) throws MPIException { @@ -185,7 +185,7 @@ else if(base instanceof LongBuffer || base instanceof DoubleBuffer) /** * Java binding of {@code MPI_WIN_DETACH}. * @param base initial address of window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void detach(Buffer base) throws MPIException { @@ -201,7 +201,7 @@ public void detach(Buffer base) throws MPIException /** * Java binding of the MPI operation {@code MPI_GET_GROUP}. * @return group of processes which share access to the window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Group getGroup() throws MPIException { @@ -220,7 +220,7 @@ public Group getGroup() throws MPIException * @param targetDisp displacement from start of window to target buffer * @param targetCount number of entries in target buffer * @param targetType datatype of each entry in target buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void put(Buffer origin, int orgCount, Datatype orgType, int targetRank, int targetDisp, int targetCount, @@ -251,7 +251,7 @@ private native void put( * @param targetDisp displacement from start of window to target buffer * @param targetCount number of entries in target buffer * @param targetType datatype of each entry in target buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void get(Buffer origin, int orgCount, Datatype orgType, int targetRank, int targetDisp, int targetCount, @@ -283,7 +283,7 @@ private native void get( * @param targetCount number of entries in target buffer * @param targetType datatype of each entry in target buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void accumulate(Buffer origin, int orgCount, Datatype orgType, int targetRank, int targetDisp, int targetCount, @@ -308,7 +308,7 @@ private native void accumulate( /** * Java binding of {@code MPI_WIN_FENCE}. * @param assertion program assertion - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void fence(int assertion) throws MPIException { @@ -322,7 +322,7 @@ public void fence(int assertion) throws MPIException * Java binding of the MPI operation {@code MPI_WIN_START}. * @param group group of target processes * @param assertion program assertion - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void start(Group group, int assertion) throws MPIException { @@ -335,7 +335,7 @@ private native void start(long win, long group, int assertion) /** * Java binding of the MPI operation {@code MPI_WIN_COMPLETE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void complete() throws MPIException { @@ -349,7 +349,7 @@ public void complete() throws MPIException * Java binding of the MPI operation {@code MPI_WIN_POST}. * @param group group of origin processes * @param assertion program assertion - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void post(Group group, int assertion) throws MPIException { @@ -362,7 +362,7 @@ private native void post(long win, long group, int assertion) /** * Java binding of the MPI operation {@code MPI_WIN_WAIT}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void waitFor() throws MPIException { @@ -375,7 +375,7 @@ public void waitFor() throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_TEST}. * @return true if success - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public boolean test() throws MPIException { @@ -390,7 +390,7 @@ public boolean test() throws MPIException * @param lockType either MPI.LOCK_EXCLUSIVE or MPI.LOCK_SHARED * @param rank rank of locked window * @param assertion program assertion - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void lock(int lockType, int rank, int assertion) throws MPIException { @@ -404,7 +404,7 @@ private native void lock(long win, int lockType, int rank, int assertion) /** * Java binding of the MPI operation {@code MPI_WIN_UNLOCK}. * @param rank rank of window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void unlock(int rank) throws MPIException { @@ -417,7 +417,7 @@ public void unlock(int rank) throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_SET_ERRHANDLER}. * @param errhandler new MPI error handler for window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setErrhandler(Errhandler errhandler) throws MPIException { @@ -431,7 +431,7 @@ private native void setErrhandler(long win, long errhandler) /** * Java binding of the MPI operation {@code MPI_WIN_GET_ERRHANDLER}. * @return MPI error handler currently associated with window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Errhandler getErrhandler() throws MPIException { @@ -444,7 +444,7 @@ public Errhandler getErrhandler() throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_CALL_ERRHANDLER}. * @param errorCode error code - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void callErrhandler(int errorCode) throws MPIException { @@ -458,7 +458,7 @@ private native void callErrhandler(long handle, int errorCode) * Create a new attribute key. *

Java binding of the MPI operation {@code MPI_WIN_CREATE_KEYVAL}. * @return attribute key for future access - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static int createKeyval() throws MPIException { @@ -472,7 +472,7 @@ public static int createKeyval() throws MPIException * Frees an attribute key. *

Java binding of the MPI operation {@code MPI_WIN_FREE_KEYVAL}. * @param keyval attribute key - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public static void freeKeyval(int keyval) throws MPIException { @@ -487,7 +487,7 @@ public static void freeKeyval(int keyval) throws MPIException *

Java binding of the MPI operation {@code MPI_WIN_SET_ATTR}. * @param keyval attribute key * @param value attribute value - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setAttr(int keyval, Object value) throws MPIException { @@ -503,7 +503,7 @@ private native void setAttr(long win, int keyval, byte[] value) *

Java binding of the MPI operation {@code MPI_WIN_GET_ATTR}. * @param keyval attribute key * @return attribute value or null if no attribute is associated with the key. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Object getAttr(int keyval) throws MPIException { @@ -518,7 +518,7 @@ public Object getAttr(int keyval) throws MPIException * Deletes an attribute value associated with a key. *

Java binding of the MPI operation {@code MPI_WIN_DELETE_ATTR}. * @param keyval attribute key - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void deleteAttr(int keyval) throws MPIException { @@ -530,7 +530,7 @@ public void deleteAttr(int keyval) throws MPIException /** * Java binding of {@code MPI_WIN_FREE}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ @Override public void free() throws MPIException { @@ -543,7 +543,7 @@ public void deleteAttr(int keyval) throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_GET_INFO}. * @return Info Info object associated with this window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Info getInfo() throws MPIException { @@ -557,7 +557,7 @@ private native long getInfo(long win) /** * Java binding of the MPI operation {@code MPI_WIN_SET_INFO}. * @param info the new info - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setInfo(Info info) throws MPIException { @@ -578,7 +578,7 @@ private native void setInfo(long win, long info) * @param target_count number of entries in target buffer * @param target_datatype datatype of each entry in target buffer * @return RMA request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request rPut(Buffer origin_addr, int origin_count, Datatype origin_datatype, int target_rank, int target_disp, @@ -609,7 +609,7 @@ private native long rPut(long win, Buffer origin_addr, int origin_count, * @param targetCount number of entries in target buffer * @param targetType datatype of each entry in target buffer * @return RMA request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public final Request rGet(Buffer origin, int orgCount, Datatype orgType, int targetRank, int targetDisp, int targetCount, @@ -643,7 +643,7 @@ private native long rGet( * @param targetType datatype of each entry in target buffer * @param op reduce operation * @return RMA request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request rAccumulate(Buffer origin, int orgCount, Datatype orgType, int targetRank, int targetDisp, int targetCount, @@ -679,7 +679,7 @@ private native long rAccumulate( * @param targetCount number of entries in target buffer * @param targetType datatype of each entry in target buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void getAccumulate(Buffer origin, int orgCount, Datatype orgType, @@ -719,7 +719,7 @@ private native void getAccumulate( * @param targetType datatype of each entry in target buffer * @param op reduce operation * @return RMA request - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public Request rGetAccumulate(Buffer origin, int orgCount, Datatype orgType, @@ -749,7 +749,7 @@ private native long rGetAccumulate( /** * Java binding of the MPI operation {@code MPI_WIN_LOCK_ALL}. * @param assertion program assertion - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void lockAll(int assertion) throws MPIException { @@ -762,7 +762,7 @@ private native void lockAll(long win, int assertion) /** * Java binding of the MPI operation {@code MPI_WIN_UNLOCK_ALL}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void unlockAll() throws MPIException { @@ -774,7 +774,7 @@ public void unlockAll() throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_SYNC}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void sync() throws MPIException { @@ -787,7 +787,7 @@ public void sync() throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_FLUSH}. * @param targetRank rank of target window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void flush(int targetRank) throws MPIException { @@ -799,7 +799,7 @@ public void flush(int targetRank) throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_FLUSH_ALL}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void flushAll() throws MPIException { @@ -817,7 +817,7 @@ public void flushAll() throws MPIException * @param targetType datatype of each entry in target buffer * @param targetRank rank of target * @param targetDisp displacement from start of window to target buffer - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void compareAndSwap(Buffer origin, Buffer compareAddr, Buffer resultAddr, @@ -845,7 +845,7 @@ private native void compareAndSwap( * @param targetRank rank of target * @param targetDisp displacement from start of window to target buffer * @param op reduce operation - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void fetchAndOp(Buffer origin, Buffer resultAddr, Datatype dataType, @@ -868,7 +868,7 @@ private native void fetchAndOp( /** * Java binding of the MPI operation {@code MPI_WIN_FLUSH_LOCAL}. * @param targetRank rank of target window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void flushLocal(int targetRank) throws MPIException @@ -881,7 +881,7 @@ public void flushLocal(int targetRank) throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_FLUSH_LOCAL_ALL}. - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void flushLocalAll() throws MPIException @@ -895,7 +895,7 @@ public void flushLocalAll() throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_GET_NAME}. * @return the name associated with this window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public String getName() throws MPIException { @@ -908,7 +908,7 @@ public String getName() throws MPIException /** * Java binding of the MPI operation {@code MPI_WIN_SET_NAME}. * @param name the name to associate with this window - * @throws MPIException Signals that an MPI exception of some sort has occurred. + * @throws MPIException Signals that an MPI error of some sort has occurred. */ public void setName(String name) throws MPIException { diff --git a/ompi/mpi/man/man3/MPI_Errhandler_create.3in b/ompi/mpi/man/man3/MPI_Errhandler_create.3in index 1c7aebd9821..806c4f3999b 100644 --- a/ompi/mpi/man/man3/MPI_Errhandler_create.3in +++ b/ompi/mpi/man/man3/MPI_Errhandler_create.3in @@ -46,7 +46,7 @@ Fortran only: Error status (integer). .ft R Note that use of this routine is \fIdeprecated\fP as of MPI-2. Please use MPI_Comm_create_errhandler instead. .sp -Registers the user routine function for use as an MPI exception handler. Returns in errhandler a handle to the registered exception handler. +Registers the user routine function for use as an MPI error handler. Returns in errhandler a handle to the registered error handler. .sp In the C language, the user routine should be a C function of type MPI_Handler_function, which is defined as .sp diff --git a/ompi/mpi/man/man3/MPI_File_create_errhandler.3in b/ompi/mpi/man/man3/MPI_File_create_errhandler.3in index 3974c2c661d..c5cabc644c4 100644 --- a/ompi/mpi/man/man3/MPI_File_create_errhandler.3in +++ b/ompi/mpi/man/man3/MPI_File_create_errhandler.3in @@ -61,7 +61,7 @@ Fortran only: Error status (integer). .SH DESCRIPTION .ft R -Registers the user routine \fIfunction\fP for use as an MPI exception handler. Returns in errhandler a handle to the registered exception handler. +Registers the user routine \fIfunction\fP for use as an MPI error handler. Returns in errhandler a handle to the registered error handler. .sp In the C language, the user routine \fIfunction\fP should be a C function of type MPI_File_errhandler_function, which is defined as .sp diff --git a/ompi/mpi/man/man3/MPI_Get_count.3in b/ompi/mpi/man/man3/MPI_Get_count.3in index 44b719d74bb..3dd49ae83a0 100644 --- a/ompi/mpi/man/man3/MPI_Get_count.3in +++ b/ompi/mpi/man/man3/MPI_Get_count.3in @@ -80,7 +80,7 @@ is returned instead. .SH ERRORS If the value to be returned is larger than can fit into the .I count -parameter, an MPI_ERR_TRUNCATE exception is invoked. +parameter, an MPI_ERR_TRUNCATE error is raised. .sp Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. .sp diff --git a/ompi/mpi/man/man3/MPI_Init.3in b/ompi/mpi/man/man3/MPI_Init.3in index b68cf035b52..c1790c9e38a 100644 --- a/ompi/mpi/man/man3/MPI_Init.3in +++ b/ompi/mpi/man/man3/MPI_Init.3in @@ -51,7 +51,7 @@ Fortran only: Error status (integer). .SH DESCRIPTION .ft R This routine, or MPI_Init_thread, must be called before most other MPI -routines are called. There are a small number of exceptions, such as +routines are called. There are a small number of errors, such as MPI_Initialized and MPI_Finalized. MPI can be initialized at most once; subsequent calls to MPI_Init or MPI_Init_thread are erroneous. .sp diff --git a/ompi/mpi/man/man3/MPI_Test.3in b/ompi/mpi/man/man3/MPI_Test.3in index 43222245fe2..36026cb9503 100644 --- a/ompi/mpi/man/man3/MPI_Test.3in +++ b/ompi/mpi/man/man3/MPI_Test.3in @@ -82,7 +82,7 @@ generated the request); the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. .sp -Note that per MPI-1 section 3.2.5, MPI exceptions on requests passed +Note that per MPI-1 section 3.2.5, MPI errors on requests passed to MPI_TEST do not set the status.MPI_ERROR field in the returned status. The error code is passed to the back-end error handler and may be passed back to the caller through the return value of diff --git a/ompi/mpi/man/man3/MPI_Testall.3in b/ompi/mpi/man/man3/MPI_Testall.3in index fc04c52decc..04b75c4b2f2 100644 --- a/ompi/mpi/man/man3/MPI_Testall.3in +++ b/ompi/mpi/man/man3/MPI_Testall.3in @@ -78,10 +78,10 @@ and neither \fIarray_of_requests\fP nor \fIarray_of_statuses\fP is modified. .SH ERRORS For each invocation of MPI_Testall, if one or more requests generate -an MPI exception, only the \fIfirst\fP MPI request that caused an -exception will be passed to its corresponding error handler. No other +an MPI error, only the \fIfirst\fP MPI request that caused an +error will be passed to its corresponding error handler. No other error handlers will be invoked (even if multiple requests generated -exceptions). However, \fIall\fP requests that generate an exception +errors). However, \fIall\fP requests that generate an error will have a relevant error code set in the corresponding status.MPI_ERROR field (unless MPI_STATUSES_IGNORE was used). .sp diff --git a/ompi/mpi/man/man3/MPI_Testany.3in b/ompi/mpi/man/man3/MPI_Testany.3in index 28abc7feed0..169fd546a0d 100644 --- a/ompi/mpi/man/man3/MPI_Testany.3in +++ b/ompi/mpi/man/man3/MPI_Testany.3in @@ -87,7 +87,7 @@ generated the request); the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. .sp -Note that per MPI-1 section 3.2.5, MPI exceptions on requests passed +Note that per MPI-1 section 3.2.5, MPI errors on requests passed to MPI_TESTANY do not set the status.MPI_ERROR field in the returned status. The error code is passed to the back-end error handler and may be passed back to the caller through the return value of diff --git a/ompi/mpi/man/man3/MPI_Testsome.3in b/ompi/mpi/man/man3/MPI_Testsome.3in index 67d33c77473..4deb07dd712 100644 --- a/ompi/mpi/man/man3/MPI_Testsome.3in +++ b/ompi/mpi/man/man3/MPI_Testsome.3in @@ -98,10 +98,10 @@ A server with multiple clients can use MPI_Waitsome so as not to starve any clie .SH ERRORS For each invocation of MPI_Testsome, if one or more requests generate -an MPI exception, only the \fIfirst\fP MPI request that caused an -exception will be passed to its corresponding error handler. No other +an MPI error, only the \fIfirst\fP MPI request that caused an +error will be passed to its corresponding error handler. No other error handlers will be invoked (even if multiple requests generated -exceptions). However, \fIall\fP requests that generate an exception +errors). However, \fIall\fP requests that generate an error will have a relevant error code set in the corresponding status.MPI_ERROR field (unless MPI_STATUSES_IGNORE was used). .sp diff --git a/ompi/mpi/man/man3/MPI_Wait.3in b/ompi/mpi/man/man3/MPI_Wait.3in index 9fc95fdf103..0d1434e00ff 100644 --- a/ompi/mpi/man/man3/MPI_Wait.3in +++ b/ompi/mpi/man/man3/MPI_Wait.3in @@ -88,7 +88,7 @@ generated the request); the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. .sp -Note that per MPI-1 section 3.2.5, MPI exceptions on requests passed +Note that per MPI-1 section 3.2.5, MPI errors on requests passed to MPI_WAIT do not set the status.MPI_ERROR field in the returned status. The error code is passed to the back-end error handler and may be passed back to the caller through the return value of diff --git a/ompi/mpi/man/man3/MPI_Waitall.3in b/ompi/mpi/man/man3/MPI_Waitall.3in index ddb95c25eaa..bb0bcd35eb5 100644 --- a/ompi/mpi/man/man3/MPI_Waitall.3in +++ b/ompi/mpi/man/man3/MPI_Waitall.3in @@ -67,10 +67,10 @@ If your application does not need to examine the \fIarray_of_statuses\fP field, .SH ERRORS For each invocation of MPI_Waitall, if one or more requests generate -an MPI exception, only the \fIfirst\fP MPI request that caused an -exception will be passed to its corresponding error handler. No other +an MPI error, only the \fIfirst\fP MPI request that caused an +error will be passed to its corresponding error handler. No other error handlers will be invoked (even if multiple requests generated -exceptions). However, \fIall\fP requests that generate an exception +errors). However, \fIall\fP requests that generate an error will have a relevant error code set in the corresponding status.MPI_ERROR field (unless MPI_STATUSES_IGNORE was used). .sp diff --git a/ompi/mpi/man/man3/MPI_Waitany.3in b/ompi/mpi/man/man3/MPI_Waitany.3in index 46d8b91c627..f30f9988135 100644 --- a/ompi/mpi/man/man3/MPI_Waitany.3in +++ b/ompi/mpi/man/man3/MPI_Waitany.3in @@ -108,7 +108,7 @@ generated the request); the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. .sp -Note that per MPI-1 section 3.2.5, MPI exceptions on requests passed +Note that per MPI-1 section 3.2.5, MPI errors on requests passed to MPI_WAITANY do not set the status.MPI_ERROR field in the returned status. The error code is passed to the back-end error handler and may be passed back to the caller through the return value of diff --git a/ompi/mpi/man/man3/MPI_Waitsome.3in b/ompi/mpi/man/man3/MPI_Waitsome.3in index 7ad53b97c10..ca79b2b479c 100644 --- a/ompi/mpi/man/man3/MPI_Waitsome.3in +++ b/ompi/mpi/man/man3/MPI_Waitsome.3in @@ -110,10 +110,10 @@ The array of indices are in the range 0 to incount-1 for C and in the range 1 to .SH ERRORS For each invocation of MPI_Waitsome, if one or more requests generate -an MPI exception, only the \fIfirst\fP MPI request that caused an -exception will be passed to its corresponding error handler. No other +an MPI error, only the \fIfirst\fP MPI request that caused an +error will be passed to its corresponding error handler. No other error handlers will be invoked (even if multiple requests generated -exceptions). However, \fIall\fP requests that generate an exception +errors). However, \fIall\fP requests that generate an error will have a relevant error code set in the corresponding status.MPI_ERROR field (unless MPI_STATUSES_IGNORE was used). .sp diff --git a/ompi/runtime/ompi_mpi_finalize.c b/ompi/runtime/ompi_mpi_finalize.c index 4d3db4a6973..d50ed1b7535 100644 --- a/ompi/runtime/ompi_mpi_finalize.c +++ b/ompi/runtime/ompi_mpi_finalize.c @@ -119,7 +119,7 @@ int ompi_mpi_finalize(void) if (state < OMPI_MPI_STATE_INIT_COMPLETED || state >= OMPI_MPI_STATE_FINALIZE_STARTED) { /* Note that if we're not initialized or already finalized, we - cannot raise an MPI exception. The best that we can do is + cannot raise an MPI error. The best that we can do is write something to stderr. */ const char *hostname; pid_t pid = getpid(); diff --git a/ompi/runtime/params.h b/ompi/runtime/params.h index 34ab4047046..fd11f152d86 100644 --- a/ompi/runtime/params.h +++ b/ompi/runtime/params.h @@ -75,7 +75,7 @@ OMPI_DECLSPEC extern int ompi_debug_show_mpi_alloc_mem_leaks; * Whether or not to actually free MPI handles when their * corresponding destructor is invoked. If enabled, Open MPI will not * free handles, but will rather simply mark them as "freed". Any - * attempt to use them will result in an MPI exception. + * attempt to use them will result in an MPI error. * * This is good debugging for user applications to find out if they * are inadvertantly using MPI handles after they have been freed. From e6f81ed6d6f4940c95732451d6ebf4d39cde1591 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 18 Aug 2020 15:39:19 -0600 Subject: [PATCH 05/31] ofi mtl: fix problem with mrecv the ofi mtl mrecv was not properly setting the message in/out arg to MPI_MRECV to MPI_MESSAGE_NULL. Signed-off-by: Howard Pritchard --- ompi/mca/mtl/ofi/mtl_ofi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 84b7e46bf55..0baae4eb08b 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -950,6 +950,8 @@ ompi_mtl_ofi_imrecv(struct mca_mtl_base_module_t *mtl, return ompi_mtl_ofi_get_error(ret); } + *message = MPI_MESSAGE_NULL; + return OMPI_SUCCESS; } From 6df0e53421b285eef2dc0b442d818026301d29f1 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 19 Aug 2020 21:38:11 +0000 Subject: [PATCH 06/31] suppress icc long double message improve configury to check whether icc is handling no long double. This prevents seeing 100s of messages like this: icc: command line warning #10148: option '-Wno-long-double' not supported A similar patch will be needed for pmix. Signed-off-by: Howard Pritchard --- config/opal_setup_cc.m4 | 5 ++++- config/opal_setup_cxx.m4 | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/opal_setup_cc.m4 b/config/opal_setup_cc.m4 index 78e86b48665..ab9f180e3dc 100644 --- a/config/opal_setup_cc.m4 +++ b/config/opal_setup_cc.m4 @@ -16,6 +16,9 @@ dnl Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2015-2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2020 Triad National Security, LLC. All rights +dnl reserved. +dnl dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -328,7 +331,7 @@ AC_DEFUN([OPAL_SETUP_CC],[ opal_cv_cc_wno_long_double="yes" if test -s conftest.err ; then dnl Yes, it should be "ignor", in order to catch ignoring and ignore - for i in unknown invalid ignor unrecognized ; do + for i in unknown invalid ignor unrecognized 'not supported'; do $GREP -iq $i conftest.err if test "$?" = "0" ; then opal_cv_cc_wno_long_double="no" diff --git a/config/opal_setup_cxx.m4 b/config/opal_setup_cxx.m4 index a48a6ba9792..843f94f77dd 100644 --- a/config/opal_setup_cxx.m4 +++ b/config/opal_setup_cxx.m4 @@ -16,6 +16,9 @@ dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2015-2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2020 Triad National Security, LLC. All rights +dnl reserved. +dnl dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -145,7 +148,7 @@ AC_DEFUN([_OPAL_SETUP_CXX_COMPILER_BACKEND],[ opal_cv_cxx_wno_long_double="yes" if test -s conftest.err ; then dnl Yes, it should be "ignor", in order to catch ignoring and ignore - for i in unknown invalid ignor unrecognized ; do + for i in unknown invalid ignor unrecognized 'not supported'; do $GREP -iq $i conftest.err if test "$?" = "0" ; then opal_cv_cxx_wno_long_double="no" From fe73586808c33d62de7071494be024691664c07d Mon Sep 17 00:00:00 2001 From: Xi Luo Date: Sun, 24 Jun 2018 21:33:57 -0400 Subject: [PATCH 07/31] Add ADAPT module Add comments in the ADAPT module Signed-off-by: Xi Luo Signed-off-by: George Bosilca --- ompi/communicator/comm_init.c | 4 +- ompi/communicator/communicator.h | 4 + ompi/mca/coll/adapt/Makefile.am | 49 + ompi/mca/coll/adapt/coll_adapt.h | 98 ++ ompi/mca/coll/adapt/coll_adapt_algorithms.h | 95 ++ ompi/mca/coll/adapt/coll_adapt_bcast.c | 26 + ompi/mca/coll/adapt/coll_adapt_component.c | 154 ++++ ompi/mca/coll/adapt/coll_adapt_context.c | 71 ++ ompi/mca/coll/adapt/coll_adapt_context.h | 132 +++ ompi/mca/coll/adapt/coll_adapt_ibcast.c | 694 +++++++++++++++ ompi/mca/coll/adapt/coll_adapt_inbuf.c | 24 + ompi/mca/coll/adapt/coll_adapt_inbuf.h | 26 + ompi/mca/coll/adapt/coll_adapt_ireduce.c | 935 ++++++++++++++++++++ ompi/mca/coll/adapt/coll_adapt_item.c | 23 + ompi/mca/coll/adapt/coll_adapt_item.h | 25 + ompi/mca/coll/adapt/coll_adapt_module.c | 162 ++++ ompi/mca/coll/adapt/coll_adapt_reduce.c | 29 + ompi/mca/coll/base/coll_base_functions.h | 4 + ompi/request/request.h | 32 +- 19 files changed, 2579 insertions(+), 8 deletions(-) create mode 100644 ompi/mca/coll/adapt/Makefile.am create mode 100644 ompi/mca/coll/adapt/coll_adapt.h create mode 100644 ompi/mca/coll/adapt/coll_adapt_algorithms.h create mode 100644 ompi/mca/coll/adapt/coll_adapt_bcast.c create mode 100644 ompi/mca/coll/adapt/coll_adapt_component.c create mode 100644 ompi/mca/coll/adapt/coll_adapt_context.c create mode 100644 ompi/mca/coll/adapt/coll_adapt_context.h create mode 100644 ompi/mca/coll/adapt/coll_adapt_ibcast.c create mode 100644 ompi/mca/coll/adapt/coll_adapt_inbuf.c create mode 100644 ompi/mca/coll/adapt/coll_adapt_inbuf.h create mode 100644 ompi/mca/coll/adapt/coll_adapt_ireduce.c create mode 100644 ompi/mca/coll/adapt/coll_adapt_item.c create mode 100644 ompi/mca/coll/adapt/coll_adapt_item.h create mode 100644 ompi/mca/coll/adapt/coll_adapt_module.c create mode 100644 ompi/mca/coll/adapt/coll_adapt_reduce.c diff --git a/ompi/communicator/comm_init.c b/ompi/communicator/comm_init.c index bcac9170452..64dc9faf39c 100644 --- a/ompi/communicator/comm_init.c +++ b/ompi/communicator/comm_init.c @@ -382,7 +382,9 @@ static void ompi_comm_construct(ompi_communicator_t* comm) comm->c_pml_comm = NULL; comm->c_topo = NULL; comm->c_coll = NULL; - + comm->c_ibcast_tag = 0; + comm->c_ireduce_tag = 0; + /* A keyhash will be created if/when an attribute is cached on this communicator */ comm->c_keyhash = NULL; diff --git a/ompi/communicator/communicator.h b/ompi/communicator/communicator.h index 87a148dfd72..be7e7acea4e 100644 --- a/ompi/communicator/communicator.h +++ b/ompi/communicator/communicator.h @@ -187,6 +187,10 @@ struct ompi_communicator_t { /* Collectives module interface and data */ mca_coll_base_comm_coll_t *c_coll; + + /* Non-blocking collective tag */ + _Atomic int32_t c_ibcast_tag; + _Atomic int32_t c_ireduce_tag; }; typedef struct ompi_communicator_t ompi_communicator_t; diff --git a/ompi/mca/coll/adapt/Makefile.am b/ompi/mca/coll/adapt/Makefile.am new file mode 100644 index 00000000000..157304e3118 --- /dev/null +++ b/ompi/mca/coll/adapt/Makefile.am @@ -0,0 +1,49 @@ +# +# Copyright (c) 2014 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + + +sources = \ + coll_adapt_component.c \ + coll_adapt_module.c \ + coll_adapt_bcast.c \ + coll_adapt_ibcast.c \ + coll_adapt_reduce.c \ + coll_adapt_ireduce.c \ + coll_adapt.h \ + coll_adapt_algorithms.h \ + coll_adapt_context.h \ + coll_adapt_context.c \ + coll_adapt_inbuf.c \ + coll_adapt_inbuf.h \ + coll_adapt_item.c \ + coll_adapt_item.h + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +component_noinst = +component_install = +if MCA_BUILD_ompi_coll_adapt_DSO +component_install += mca_coll_adapt.la +else +component_noinst += libmca_coll_adapt.la +endif + +mcacomponentdir = $(ompilibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_coll_adapt_la_SOURCES = $(sources) +mca_coll_adapt_la_LDFLAGS = -module -avoid-version +mca_coll_adapt_la_LIBADD = + +noinst_LTLIBRARIES = $(component_noinst) +libmca_coll_adapt_la_SOURCES =$(sources) +libmca_coll_adapt_la_LDFLAGS = -module -avoid-version diff --git a/ompi/mca/coll/adapt/coll_adapt.h b/ompi/mca/coll/adapt/coll_adapt.h new file mode 100644 index 00000000000..0eaca96e5e7 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + + +#ifndef MCA_COLL_ADAPT_EXPORT_H +#define MCA_COLL_ADAPT_EXPORT_H + +#include "ompi_config.h" + +#include "mpi.h" +#include "opal/mca/mca.h" +#include "opal/datatype/opal_convertor.h" +#include "ompi/mca/coll/coll.h" +#include "ompi/mca/coll/base/coll_base_topo.h" + +BEGIN_C_DECLS typedef struct mca_coll_adapt_module_t mca_coll_adapt_module_t; + +/* + * Structure to hold the adapt coll component. First it holds the + * base coll component, and then holds a bunch of + * adapt-coll-component-specific stuff (e.g., current MCA param + * values). + */ +typedef struct mca_coll_adapt_component_t { + /* Base coll component */ + mca_coll_base_component_2_0_0_t super; + + /* MCA parameter: Priority of this component */ + int adapt_priority; + + /* MCA parameter: Output verbose level */ + int adapt_output; + + /* MCA parameter: Maximum number of segment in context free list */ + int adapt_context_free_list_max; + + /* MCA parameter: Minimum number of segment in context free list */ + int adapt_context_free_list_min; + + /* MCA parameter: Increasment number of segment in context free list */ + int adapt_context_free_list_inc; + + /* Bcast MCA parameter */ + int adapt_ibcast_algorithm; + size_t adapt_ibcast_segment_size; + int adapt_ibcast_max_send_requests; + int adapt_ibcast_max_recv_requests; + /* Bcast free list */ + opal_free_list_t *adapt_ibcast_context_free_list; + _Atomic int32_t adapt_ibcast_context_free_list_enabled; + + /* Reduce MCA parameter */ + int adapt_ireduce_algorithm; + size_t adapt_ireduce_segment_size; + int adapt_ireduce_max_send_requests; + int adapt_ireduce_max_recv_requests; + int adapt_inbuf_free_list_min; + int adapt_inbuf_free_list_max; + int adapt_inbuf_free_list_inc; + + /* Reduce free list */ + opal_free_list_t *adapt_ireduce_context_free_list; + _Atomic int32_t adapt_ireduce_context_free_list_enabled; + +} mca_coll_adapt_component_t; + +/* Coll adapt module per communicator*/ +struct mca_coll_adapt_module_t { + /* Base module */ + mca_coll_base_module_t super; + + /* Whether this module has been lazily initialized or not yet */ + bool enabled; + /* Pointer to mca_coll_adapt_component */ + mca_coll_adapt_component_t *adapt_component; +}; +OBJ_CLASS_DECLARATION(mca_coll_adapt_module_t); + +/* Global component instance */ +OMPI_MODULE_DECLSPEC extern mca_coll_adapt_component_t mca_coll_adapt_component; + +/* ADAPT module functions */ +int mca_coll_adapt_init_query(bool enable_progress_threads, bool enable_mpi_threads); + +mca_coll_base_module_t *mca_coll_adapt_comm_query(struct ompi_communicator_t *comm, int *priority); + +/* Free ADAPT quest */ +int adapt_request_free(ompi_request_t ** request); + +#endif /* MCA_COLL_ADAPT_EXPORT_H */ diff --git a/ompi/mca/coll/adapt/coll_adapt_algorithms.h b/ompi/mca/coll/adapt/coll_adapt_algorithms.h new file mode 100644 index 00000000000..8b7b7cebd4f --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_algorithms.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi/mca/coll/coll.h" +#include "ompi/mca/coll/base/coll_base_topo.h" +#include "ompi/mca/coll/base/coll_base_functions.h" +#include + +typedef struct mca_coll_adapt_algorithm_index_s { + int algorithm_index; + uintptr_t algorithm_fn_ptr; +} mca_coll_adapt_algorithm_index_t; + +/* Bcast */ +int mca_coll_adapt_ibcast_init(void); +int mca_coll_adapt_ibcast_fini(void); +int mca_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, mca_coll_base_module_t * module); +int mca_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module); +int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, ompi_coll_tree_t * tree, + size_t seg_size, int ibcast_tag); +int mca_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module, + int ibcast_tag); +int mca_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag); +int mca_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag); +int mca_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module, + int ibcast_tag); +int mca_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag); +int mca_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag); + + +/* Reduce */ +int mca_coll_adapt_ireduce_init(void); +int mca_coll_adapt_ireduce_fini(void); +int mca_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, + struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, + mca_coll_base_module_t * module); +int mca_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, + struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module); +int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, ompi_coll_tree_t * tree, + size_t seg_size, int ireduce_tag); +int mca_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag); +int mca_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag); +int mca_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag); +int mca_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag); +int mca_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag); +int mca_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag); diff --git a/ompi/mca/coll/adapt/coll_adapt_bcast.c b/ompi/mca/coll/adapt/coll_adapt_bcast.c new file mode 100644 index 00000000000..4348f2dc3b5 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_bcast.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "coll_adapt.h" +#include "coll_adapt_algorithms.h" + +int mca_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, mca_coll_base_module_t * module) +{ + if (count == 0) { + return MPI_SUCCESS; + } else { + ompi_request_t *request; + int err = mca_coll_adapt_ibcast(buff, count, datatype, root, comm, &request, module); + ompi_request_wait(&request, MPI_STATUS_IGNORE); + return err; + } +} diff --git a/ompi/mca/coll/adapt/coll_adapt_component.c b/ompi/mca/coll/adapt/coll_adapt_component.c new file mode 100644 index 00000000000..6079c4d92ea --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_component.c @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "opal/util/show_help.h" +#include "ompi/constants.h" +#include "ompi/mca/coll/coll.h" +#include "coll_adapt.h" +#include "coll_adapt_algorithms.h" + +/* + * Public string showing the coll ompi_adapt component version number + */ +const char *mca_coll_adapt_component_version_string = + "Open MPI ADAPT collective MCA component version " OMPI_VERSION; + +/* + * Local functions + */ +static int adapt_open(void); +static int adapt_close(void); +static int adapt_register(void); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ + +mca_coll_adapt_component_t mca_coll_adapt_component = { + + /* First, fill in the super */ + + { + /* First, the mca_component_t struct containing meta + information about the component itself */ + + { + MCA_COLL_BASE_VERSION_2_0_0, + + /* Component name and version */ + "adapt", + OMPI_MAJOR_VERSION, + OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION, + + /* Component functions */ + adapt_open, /* open */ + adapt_close, + NULL, /* query */ + adapt_register}, + { + /* The component is not checkpoint ready */ + MCA_BASE_METADATA_PARAM_NONE}, + + /* Initialization / querying functions */ + mca_coll_adapt_init_query, + mca_coll_adapt_comm_query, + }, + + /* adapt-component specific information */ + + /* (default) priority */ + 0, + + /* (default) verbose level */ + 0, + + /* default values for non-MCA parameters */ + /* Not specifying values here gives us all 0's */ +}; + +/* Open the component */ +static int adapt_open(void) +{ + return OMPI_SUCCESS; +} + + +/* Shut down the component */ +static int adapt_close(void) +{ + mca_coll_adapt_ibcast_fini(); + mca_coll_adapt_ireduce_fini(); + + return OMPI_SUCCESS; +} + +static int adapt_verify_mca_variables(void) +{ + return OMPI_SUCCESS; +} + +/* + * Register MCA params + */ +static int adapt_register(void) +{ + mca_base_component_t *c = &mca_coll_adapt_component.super.collm_version; + mca_coll_adapt_component_t *cs = &mca_coll_adapt_component; + + /* If we want to be selected (i.e., all procs on one node), then + we should have a high priority */ + cs->adapt_priority = 0; + (void) mca_base_component_var_register(c, "priority", "Priority of the adapt coll component", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_priority); + + int adapt_verbose = 0; + (void) mca_base_component_var_register(c, "verbose", + "Verbose level", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, &adapt_verbose); + cs->adapt_output = opal_output_open(NULL); + opal_output_set_verbosity(cs->adapt_output, adapt_verbose); + + cs->adapt_context_free_list_min = 10; + (void) mca_base_component_var_register(c, "context_free_list_max", + "Minimum number of segments in context free list", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &cs->adapt_context_free_list_min); + + cs->adapt_context_free_list_max = 10000; + (void) mca_base_component_var_register(c, "context_free_list_min", + "Maximum number of segments in context free list", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &cs->adapt_context_free_list_max); + + cs->adapt_context_free_list_inc = 10; + (void) mca_base_component_var_register(c, "context_free_list_inc", + "Increasement number of segments in context free list", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &cs->adapt_context_free_list_inc); + mca_coll_adapt_ibcast_init(); + mca_coll_adapt_ireduce_init(); + + return adapt_verify_mca_variables(); +} diff --git a/ompi/mca/coll/adapt/coll_adapt_context.c b/ompi/mca/coll/adapt/coll_adapt_context.c new file mode 100644 index 00000000000..978739df9ab --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_context.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi/mca/coll/coll.h" +#include "coll_adapt_context.h" + +static void mca_coll_adapt_bcast_context_constructor(mca_coll_adapt_bcast_context_t * bcast_context) +{ +} + +static void mca_coll_adapt_bcast_context_destructor(mca_coll_adapt_bcast_context_t * bcast_context) +{ + +} + +static void +mca_coll_adapt_constant_bcast_context_constructor(mca_coll_adapt_constant_bcast_context_t * con) +{ +} + +static void mca_coll_adapt_constant_bcast_context_destructor(mca_coll_adapt_constant_bcast_context_t + * con) +{ +} + + +OBJ_CLASS_INSTANCE(mca_coll_adapt_bcast_context_t, opal_free_list_item_t, + mca_coll_adapt_bcast_context_constructor, + mca_coll_adapt_bcast_context_destructor); + +OBJ_CLASS_INSTANCE(mca_coll_adapt_constant_bcast_context_t, opal_object_t, + mca_coll_adapt_constant_bcast_context_constructor, + mca_coll_adapt_constant_bcast_context_destructor); + +static void mca_coll_adapt_reduce_context_constructor(mca_coll_adapt_reduce_context_t * + reduce_context) +{ +} + +static void mca_coll_adapt_reduce_context_destructor(mca_coll_adapt_reduce_context_t * + reduce_context) +{ + +} + +static void +mca_coll_adapt_constant_reduce_context_constructor(mca_coll_adapt_constant_reduce_context_t * con) +{ +} + +static void +mca_coll_adapt_constant_reduce_context_destructor(mca_coll_adapt_constant_reduce_context_t * con) +{ +} + + +OBJ_CLASS_INSTANCE(mca_coll_adapt_reduce_context_t, opal_free_list_item_t, + mca_coll_adapt_reduce_context_constructor, + mca_coll_adapt_reduce_context_destructor); + +OBJ_CLASS_INSTANCE(mca_coll_adapt_constant_reduce_context_t, opal_object_t, + mca_coll_adapt_constant_reduce_context_constructor, + mca_coll_adapt_constant_reduce_context_destructor); diff --git a/ompi/mca/coll/adapt/coll_adapt_context.h b/ompi/mca/coll/adapt/coll_adapt_context.h new file mode 100644 index 00000000000..917e3d48861 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_context.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi/mca/coll/coll.h" +#include "opal/class/opal_free_list.h" +#include "opal/class/opal_list.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/communicator/communicator.h" +#include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_topo.h" +#include "coll_adapt_inbuf.h" + +/* Bcast constant context in bcast context */ +struct mca_coll_adapt_constant_bcast_context_s { + opal_object_t super; + int root; + size_t count; + size_t seg_count; + ompi_datatype_t *datatype; + ompi_communicator_t *comm; + int real_seg_size; + int num_segs; + ompi_request_t *request; + opal_mutex_t *mutex; + int *recv_array; + int *send_array; + /* Length of the fragment array, which is the number of recevied segments */ + int num_recv_segs; + /* Number of segments that is finishing recving */ + int num_recv_fini; + /* Store the number of sent segments */ + int num_sent_segs; + ompi_coll_tree_t *tree; + int ibcast_tag; +}; + +typedef struct mca_coll_adapt_constant_bcast_context_s mca_coll_adapt_constant_bcast_context_t; + +OBJ_CLASS_DECLARATION(mca_coll_adapt_constant_bcast_context_t); + + +/* Bcast context of each segment*/ +typedef struct mca_coll_adapt_bcast_context_s mca_coll_adapt_bcast_context_t; + +typedef int (*mca_coll_adapt_bcast_cuda_callback_fn_t) (mca_coll_adapt_bcast_context_t * context); + +struct mca_coll_adapt_bcast_context_s { + opal_free_list_item_t super; + char *buff; + int frag_id; + int child_id; + int peer; + mca_coll_adapt_constant_bcast_context_t *con; +}; + +OBJ_CLASS_DECLARATION(mca_coll_adapt_bcast_context_t); + +/* Reduce constant context in reduce context */ +struct mca_coll_adapt_constant_reduce_context_s { + opal_object_t super; + size_t count; + size_t seg_count; + ompi_datatype_t *datatype; + ompi_communicator_t *comm; + size_t real_seg_size; + /* Increment of each segment */ + int segment_increment; + int num_segs; + ompi_request_t *request; + int rank; + /* Length of the fragment array, which is the number of recevied segments */ + int32_t num_recv_segs; + /* Number of sent segments */ + int32_t num_sent_segs; + /* Next seg need to be received for every children */ + _Atomic int32_t *next_recv_segs; + /* Mutex to protect recv_list */ + opal_mutex_t *mutex_recv_list; + /* Mutex to protect num_recv_segs */ + opal_mutex_t *mutex_num_recv_segs; + /* Mutex to protect num_sent */ + opal_mutex_t *mutex_num_sent; + /* Mutex to protect each segment when do the reduce op */ + opal_mutex_t **mutex_op_list; + /* Reduce operation */ + ompi_op_t *op; + ompi_coll_tree_t *tree; + /* Accumulate buff */ + char **accumbuf; + opal_free_list_t *inbuf_list; + /* A list to store the segments which are received and not yet be sent */ + opal_list_t *recv_list; + ptrdiff_t lower_bound; + /* How many sends are posted but not finished */ + _Atomic int32_t ongoing_send; + char *sbuf; + char *rbuf; + int root; + /* The distance between the address of inbuf->buff and the address of inbuf */ + int distance; + int ireduce_tag; +}; + +typedef struct mca_coll_adapt_constant_reduce_context_s mca_coll_adapt_constant_reduce_context_t; + +OBJ_CLASS_DECLARATION(mca_coll_adapt_constant_reduce_context_t); + +/* Reduce context of each segment */ +typedef struct mca_coll_adapt_reduce_context_s mca_coll_adapt_reduce_context_t; + +typedef int (*mca_coll_adapt_reduce_cuda_callback_fn_t) (mca_coll_adapt_reduce_context_t * context); + +struct mca_coll_adapt_reduce_context_s { + opal_free_list_item_t super; + char *buff; + int frag_id; + int child_id; + int peer; + mca_coll_adapt_constant_reduce_context_t *con; + /* store the incoming segment */ + mca_coll_adapt_inbuf_t *inbuf; +}; + +OBJ_CLASS_DECLARATION(mca_coll_adapt_reduce_context_t); diff --git a/ompi/mca/coll/adapt/coll_adapt_ibcast.c b/ompi/mca/coll/adapt/coll_adapt_ibcast.c new file mode 100644 index 00000000000..3582bafcb62 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_ibcast.c @@ -0,0 +1,694 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "ompi/mca/pml/pml.h" +#include "coll_adapt.h" +#include "coll_adapt_algorithms.h" +#include "coll_adapt_context.h" +#include "ompi/mca/coll/base/coll_tags.h" +#include "ompi/mca/coll/base/coll_base_functions.h" +#include "opal/util/bit_ops.h" +#include "opal/sys/atomic.h" +#include "ompi/mca/pml/ob1/pml_ob1.h" + + +typedef int (*mca_coll_adapt_ibcast_fn_t) (void *buff, + int count, + struct ompi_datatype_t * datatype, + int root, + struct ompi_communicator_t * comm, + ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag); + +static mca_coll_adapt_algorithm_index_t mca_coll_adapt_ibcast_algorithm_index[] = { + {1, (uintptr_t) mca_coll_adapt_ibcast_binomial}, + {2, (uintptr_t) mca_coll_adapt_ibcast_in_order_binomial}, + {3, (uintptr_t) mca_coll_adapt_ibcast_binary}, + {4, (uintptr_t) mca_coll_adapt_ibcast_pipeline}, + {5, (uintptr_t) mca_coll_adapt_ibcast_chain}, + {6, (uintptr_t) mca_coll_adapt_ibcast_linear}, +}; + +/* + * Set up MCA parameters of MPI_Bcast and MPI_IBcast + */ +int mca_coll_adapt_ibcast_init(void) +{ + mca_base_component_t *c = &mca_coll_adapt_component.super.collm_version; + + mca_coll_adapt_component.adapt_ibcast_algorithm = 1; + mca_base_component_var_register(c, "bcast_algorithm", + "Algorithm of broadcast, 1: binomial, 2: in_order_binomial, 3: binary, 4: pipeline, 5: chain, 6: linear", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_ibcast_algorithm); + + mca_coll_adapt_component.adapt_ibcast_segment_size = 0; + mca_base_component_var_register(c, "bcast_segment_size", + "Segment size in bytes used by default for bcast algorithms. Only has meaning if algorithm is forced and supports segmenting. 0 bytes means no segmentation.", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_ibcast_segment_size); + + mca_coll_adapt_component.adapt_ibcast_max_send_requests = 2; + mca_base_component_var_register(c, "bcast_max_send_requests", + "Maximum number of send requests", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_ibcast_max_send_requests); + + mca_coll_adapt_component.adapt_ibcast_max_recv_requests = 3; + mca_base_component_var_register(c, "bcast_max_recv_requests", + "Maximum number of receive requests", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_ibcast_max_recv_requests); + + mca_coll_adapt_component.adapt_ibcast_context_free_list = NULL; + mca_coll_adapt_component.adapt_ibcast_context_free_list_enabled = 0; + return OMPI_SUCCESS; +} + +/* + * Release the free list created in mca_coll_adapt_ibcast_generic + */ +int mca_coll_adapt_ibcast_fini(void) +{ + if (NULL != mca_coll_adapt_component.adapt_ibcast_context_free_list) { + OBJ_RELEASE(mca_coll_adapt_component.adapt_ibcast_context_free_list); + mca_coll_adapt_component.adapt_ibcast_context_free_list = NULL; + mca_coll_adapt_component.adapt_ibcast_context_free_list_enabled = 0; + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "ibcast fini\n")); + } + return OMPI_SUCCESS; +} + +/* + * Finish a ibcast request + */ +static int ibcast_request_fini(mca_coll_adapt_bcast_context_t * context) +{ + ompi_request_t *temp_req = context->con->request; + if (context->con->tree->tree_nextsize != 0) { + free(context->con->send_array); + } + if (context->con->num_segs != 0) { + free(context->con->recv_array); + } + OBJ_RELEASE(context->con->mutex); + OBJ_RELEASE(context->con); + OBJ_RELEASE(context->con); + opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, + (opal_free_list_item_t *) context); + ompi_request_complete(temp_req, 1); + + return OMPI_SUCCESS; +} + +/* + * Callback function of isend + */ +static int send_cb(ompi_request_t * req) +{ + mca_coll_adapt_bcast_context_t *context = + (mca_coll_adapt_bcast_context_t *) req->req_complete_cb_data; + + int err; + + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Send(cb): segment %d to %d at buff %p root %d\n", + ompi_comm_rank(context->con->comm), context->frag_id, + context->peer, (void *) context->buff, context->con->root)); + + OPAL_THREAD_LOCK(context->con->mutex); + int sent_id = context->con->send_array[context->child_id]; + /* If the current process has fragments in recv_array can be sent */ + if (sent_id < context->con->num_recv_segs) { + ompi_request_t *send_req; + int new_id = context->con->recv_array[sent_id]; + mca_coll_adapt_bcast_context_t *send_context = + (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. + adapt_ibcast_context_free_list); + send_context->buff = + context->buff + (new_id - context->frag_id) * context->con->real_seg_size; + send_context->frag_id = new_id; + send_context->child_id = context->child_id; + send_context->peer = context->peer; + send_context->con = context->con; + OBJ_RETAIN(context->con); + int send_count = send_context->con->seg_count; + if (new_id == (send_context->con->num_segs - 1)) { + send_count = send_context->con->count - new_id * send_context->con->seg_count; + } + ++(send_context->con->send_array[send_context->child_id]); + char *send_buff = send_context->buff; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Send(start in send cb): segment %d to %d at buff %p send_count %d tag %d\n", + ompi_comm_rank(send_context->con->comm), send_context->frag_id, + send_context->peer, (void *) send_context->buff, send_count, + (send_context->con->ibcast_tag << 16) + new_id)); + err = + MCA_PML_CALL(isend + (send_buff, send_count, send_context->con->datatype, send_context->peer, + (send_context->con->ibcast_tag << 16) + new_id, + MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); + if (MPI_SUCCESS != err) { + OPAL_THREAD_UNLOCK(context->con->mutex); + return err; + } + /* Invoke send call back */ + OPAL_THREAD_UNLOCK(context->con->mutex); + ompi_request_set_callback(send_req, send_cb, send_context); + OPAL_THREAD_LOCK(context->con->mutex); + } + + int num_sent = ++(context->con->num_sent_segs); + int num_recv_fini_t = context->con->num_recv_fini; + int rank = ompi_comm_rank(context->con->comm); + opal_mutex_t *mutex_temp = context->con->mutex; + /* Check whether signal the condition */ + if ((rank == context->con->root + && num_sent == context->con->tree->tree_nextsize * context->con->num_segs) + || (context->con->tree->tree_nextsize > 0 && rank != context->con->root + && num_sent == context->con->tree->tree_nextsize * context->con->num_segs + && num_recv_fini_t == context->con->num_segs) || (context->con->tree->tree_nextsize == 0 + && num_recv_fini_t == + context->con->num_segs)) { + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: Singal in send\n", + ompi_comm_rank(context->con->comm))); + OPAL_THREAD_UNLOCK(mutex_temp); + ibcast_request_fini(context); + } else { + OBJ_RELEASE(context->con); + opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, + (opal_free_list_item_t *) context); + OPAL_THREAD_UNLOCK(mutex_temp); + } + req->req_free(&req); + /* Call back function return 1, which means successful */ + return 1; +} + +/* + * Callback function of irecv + */ +static int recv_cb(ompi_request_t * req) +{ + /* Get necessary info from request */ + mca_coll_adapt_bcast_context_t *context = + (mca_coll_adapt_bcast_context_t *) req->req_complete_cb_data; + + int err, i; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Recv(cb): segment %d from %d at buff %p root %d\n", + ompi_comm_rank(context->con->comm), context->frag_id, + context->peer, (void *) context->buff, context->con->root)); + + /* Store the frag_id to seg array */ + OPAL_THREAD_LOCK(context->con->mutex); + int num_recv_segs_t = ++(context->con->num_recv_segs); + context->con->recv_array[num_recv_segs_t - 1] = context->frag_id; + + int new_id = num_recv_segs_t + mca_coll_adapt_component.adapt_ibcast_max_recv_requests - 1; + /* Receive new segment */ + if (new_id < context->con->num_segs) { + ompi_request_t *recv_req; + /* Get new context item from free list */ + mca_coll_adapt_bcast_context_t *recv_context = + (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. + adapt_ibcast_context_free_list); + recv_context->buff = + context->buff + (new_id - context->frag_id) * context->con->real_seg_size; + recv_context->frag_id = new_id; + recv_context->child_id = context->child_id; + recv_context->peer = context->peer; + recv_context->con = context->con; + OBJ_RETAIN(context->con); + int recv_count = recv_context->con->seg_count; + if (new_id == (recv_context->con->num_segs - 1)) { + recv_count = recv_context->con->count - new_id * recv_context->con->seg_count; + } + char *recv_buff = recv_context->buff; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Recv(start in recv cb): segment %d from %d at buff %p recv_count %d tag %d\n", + ompi_comm_rank(context->con->comm), context->frag_id, context->peer, + (void *) recv_buff, recv_count, + (recv_context->con->ibcast_tag << 16) + recv_context->frag_id)); + MCA_PML_CALL(irecv + (recv_buff, recv_count, recv_context->con->datatype, recv_context->peer, + (recv_context->con->ibcast_tag << 16) + recv_context->frag_id, + recv_context->con->comm, &recv_req)); + + /* Invoke recvive call back */ + OPAL_THREAD_UNLOCK(context->con->mutex); + ompi_request_set_callback(recv_req, recv_cb, recv_context); + OPAL_THREAD_LOCK(context->con->mutex); + } + + /* Send segment to its children */ + for (i = 0; i < context->con->tree->tree_nextsize; i++) { + /* If the current process can send the segment now, which means the only segment need to be sent is the just arrived one */ + if (num_recv_segs_t - 1 == context->con->send_array[i]) { + ompi_request_t *send_req; + int send_count = context->con->seg_count; + if (context->frag_id == (context->con->num_segs - 1)) { + send_count = context->con->count - context->frag_id * context->con->seg_count; + } + + mca_coll_adapt_bcast_context_t *send_context = + (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. + adapt_ibcast_context_free_list); + send_context->buff = context->buff; + send_context->frag_id = context->frag_id; + send_context->child_id = i; + send_context->peer = context->con->tree->tree_next[i]; + send_context->con = context->con; + OBJ_RETAIN(context->con); + ++(send_context->con->send_array[i]); + char *send_buff = send_context->buff; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Send(start in recv cb): segment %d to %d at buff %p send_count %d tag %d\n", + ompi_comm_rank(send_context->con->comm), send_context->frag_id, + send_context->peer, (void *) send_context->buff, send_count, + (send_context->con->ibcast_tag << 16) + send_context->frag_id)); + err = + MCA_PML_CALL(isend + (send_buff, send_count, send_context->con->datatype, + send_context->peer, + (send_context->con->ibcast_tag << 16) + send_context->frag_id, + MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); + if (MPI_SUCCESS != err) { + OPAL_THREAD_UNLOCK(context->con->mutex); + return err; + } + /* Invoke send call back */ + OPAL_THREAD_UNLOCK(context->con->mutex); + ompi_request_set_callback(send_req, send_cb, send_context); + OPAL_THREAD_LOCK(context->con->mutex); + } + } + + int num_sent = context->con->num_sent_segs; + int num_recv_fini_t = ++(context->con->num_recv_fini); + int rank = ompi_comm_rank(context->con->comm); + opal_mutex_t *mutex_temp = context->con->mutex; + + /* If this process is leaf and has received all the segments */ + if ((rank == context->con->root + && num_sent == context->con->tree->tree_nextsize * context->con->num_segs) + || (context->con->tree->tree_nextsize > 0 && rank != context->con->root + && num_sent == context->con->tree->tree_nextsize * context->con->num_segs + && num_recv_fini_t == context->con->num_segs) || (context->con->tree->tree_nextsize == 0 + && num_recv_fini_t == + context->con->num_segs)) { + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: Singal in recv\n", + ompi_comm_rank(context->con->comm))); + OPAL_THREAD_UNLOCK(mutex_temp); + ibcast_request_fini(context); + } else { + OBJ_RELEASE(context->con); + opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, + (opal_free_list_item_t *) context); + OPAL_THREAD_UNLOCK(mutex_temp); + } + req->req_free(&req); + return 1; +} + +int mca_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) +{ + if (count == 0) { + ompi_request_t *temp_request; + temp_request = OBJ_NEW(ompi_request_t); + OMPI_REQUEST_INIT(temp_request, false); + temp_request->req_type = 0; + temp_request->req_free = adapt_request_free; + temp_request->req_status.MPI_SOURCE = 0; + temp_request->req_status.MPI_TAG = 0; + temp_request->req_status.MPI_ERROR = 0; + temp_request->req_status._cancelled = 0; + temp_request->req_status._ucount = 0; + ompi_request_complete(temp_request, 1); + *request = temp_request; + return MPI_SUCCESS; + } else { + int rank = ompi_comm_rank(comm); + if (rank == root) { + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, + "ibcast root %d, algorithm %d, coll_adapt_ibcast_segment_size %zu, coll_adapt_ibcast_max_send_requests %d, coll_adapt_ibcast_max_recv_requests %d\n", + root, mca_coll_adapt_component.adapt_ibcast_algorithm, + mca_coll_adapt_component.adapt_ibcast_segment_size, + mca_coll_adapt_component.adapt_ibcast_max_send_requests, + mca_coll_adapt_component.adapt_ibcast_max_recv_requests)); + } + int ibcast_tag = opal_atomic_add_fetch_32(&(comm->c_ibcast_tag), 1); + ibcast_tag = ibcast_tag % 4096; + mca_coll_adapt_ibcast_fn_t bcast_func = + (mca_coll_adapt_ibcast_fn_t) + mca_coll_adapt_ibcast_algorithm_index[mca_coll_adapt_component.adapt_ibcast_algorithm]. + algorithm_fn_ptr; + return bcast_func(buff, count, datatype, root, comm, request, module, ibcast_tag); + } +} + +/* + * Ibcast functions with different algorithms + */ +int mca_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module, + int ibcast_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_bmtree(comm, root); + int err = + mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size, + ibcast_tag); + return err; +} + +int mca_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_in_order_bmtree(comm, root); + int err = + mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size, + ibcast_tag); + return err; +} + + +int mca_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_tree(2, comm, root); + int err = + mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size, + ibcast_tag); + return err; +} + +int mca_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module, + int ibcast_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(1, comm, root); + int err = + mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size, + ibcast_tag); + return err; +} + + +int mca_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(4, comm, root); + int err = + mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size, + ibcast_tag); + return err; +} + +int mca_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ibcast_tag) +{ + int fanout = ompi_comm_size(comm) - 1; + ompi_coll_tree_t *tree; + if (fanout < 1) { + tree = ompi_coll_base_topo_build_chain(1, comm, root); + } else if (fanout <= MAXTREEFANOUT) { + tree = ompi_coll_base_topo_build_tree(ompi_comm_size(comm) - 1, comm, root); + } else { + tree = ompi_coll_base_topo_build_tree(MAXTREEFANOUT, comm, root); + } + int err = + mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size, + ibcast_tag); + return err; +} + + +int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, ompi_coll_tree_t * tree, + size_t seg_size, int ibcast_tag) +{ + /* Tempory variables for iteration */ + int i, j; + /* Rank of this process */ + int rank; + /* Record return value */ + int err; + /* The min of num_segs and SEND_NUM or RECV_NUM, in case the num_segs is less than SEND_NUM or RECV_NUM */ + int min; + + /* Number of datatype in a segment */ + int seg_count = count; + /* Size of a datatype */ + size_t type_size; + /* Real size of a segment */ + size_t real_seg_size; + ptrdiff_t extent, lb; + /* Number of segments */ + int num_segs; + + /* The request passed outside */ + ompi_request_t *temp_request = NULL; + opal_mutex_t *mutex; + /* Store the segments which are received */ + int *recv_array = NULL; + /* Record how many isends have been issued for every child */ + int *send_array = NULL; + + /* Set up free list */ + if (0 == mca_coll_adapt_component.adapt_ibcast_context_free_list_enabled) { + int32_t context_free_list_enabled = + opal_atomic_add_fetch_32(& + (mca_coll_adapt_component. + adapt_ibcast_context_free_list_enabled), 1); + if (1 == context_free_list_enabled) { + mca_coll_adapt_component.adapt_ibcast_context_free_list = OBJ_NEW(opal_free_list_t); + opal_free_list_init(mca_coll_adapt_component.adapt_ibcast_context_free_list, + sizeof(mca_coll_adapt_bcast_context_t), + opal_cache_line_size, + OBJ_CLASS(mca_coll_adapt_bcast_context_t), + 0, opal_cache_line_size, + mca_coll_adapt_component.adapt_context_free_list_min, + mca_coll_adapt_component.adapt_context_free_list_max, + mca_coll_adapt_component.adapt_context_free_list_inc, + NULL, 0, NULL, NULL, NULL); + } + } + + /* Set up request */ + temp_request = OBJ_NEW(ompi_request_t); + OMPI_REQUEST_INIT(temp_request, false); + temp_request->req_state = OMPI_REQUEST_ACTIVE; + temp_request->req_type = 0; + temp_request->req_free = adapt_request_free; + temp_request->req_status.MPI_SOURCE = 0; + temp_request->req_status.MPI_TAG = 0; + temp_request->req_status.MPI_ERROR = 0; + temp_request->req_status._cancelled = 0; + temp_request->req_status._ucount = 0; + *request = temp_request; + + /* Set up mutex */ + mutex = OBJ_NEW(opal_mutex_t); + + rank = ompi_comm_rank(comm); + + /* Determine number of elements sent per operation */ + ompi_datatype_type_size(datatype, &type_size); + COLL_BASE_COMPUTED_SEGCOUNT(seg_size, type_size, seg_count); + + ompi_datatype_get_extent(datatype, &lb, &extent); + num_segs = (count + seg_count - 1) / seg_count; + real_seg_size = (ptrdiff_t) seg_count *extent; + + /* Set memory for recv_array and send_array, created on heap becasue they are needed to be accessed by other functions (callback functions) */ + if (num_segs != 0) { + recv_array = (int *) malloc(sizeof(int) * num_segs); + } + if (tree->tree_nextsize != 0) { + send_array = (int *) malloc(sizeof(int) * tree->tree_nextsize); + } + + /* Set constant context for send and recv call back */ + mca_coll_adapt_constant_bcast_context_t *con = OBJ_NEW(mca_coll_adapt_constant_bcast_context_t); + con->root = root; + con->count = count; + con->seg_count = seg_count; + con->datatype = datatype; + con->comm = comm; + con->real_seg_size = real_seg_size; + con->num_segs = num_segs; + con->recv_array = recv_array; + con->num_recv_segs = 0; + con->num_recv_fini = 0; + con->send_array = send_array; + con->num_sent_segs = 0; + con->mutex = mutex; + con->request = temp_request; + con->tree = tree; + con->ibcast_tag = ibcast_tag; + + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Ibcast, root %d, tag %d\n", rank, root, + ibcast_tag)); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: con->mutex = %p, num_children = %d, num_segs = %d, real_seg_size = %d, seg_count = %d, tree_adreess = %p\n", + rank, (void *) con->mutex, tree->tree_nextsize, num_segs, + (int) real_seg_size, seg_count, (void *) con->tree)); + + OPAL_THREAD_LOCK(mutex); + + /* If the current process is root, it sends segment to every children */ + if (rank == root) { + /* Handle the situation when num_segs < SEND_NUM */ + if (num_segs <= mca_coll_adapt_component.adapt_ibcast_max_send_requests) { + min = num_segs; + } else { + min = mca_coll_adapt_component.adapt_ibcast_max_send_requests; + } + + /* Set recv_array, root has already had all the segments */ + for (i = 0; i < num_segs; i++) { + recv_array[i] = i; + } + con->num_recv_segs = num_segs; + /* Set send_array, will send adapt_ibcast_max_send_requests segments */ + for (i = 0; i < tree->tree_nextsize; i++) { + send_array[i] = mca_coll_adapt_component.adapt_ibcast_max_send_requests; + } + + ompi_request_t *send_req; + /* Number of datatypes in each send */ + int send_count = seg_count; + for (i = 0; i < min; i++) { + if (i == (num_segs - 1)) { + send_count = count - i * seg_count; + } + for (j = 0; j < tree->tree_nextsize; j++) { + mca_coll_adapt_bcast_context_t *context = + (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. + adapt_ibcast_context_free_list); + context->buff = (char *) buff + i * real_seg_size; + context->frag_id = i; + /* The id of peer in in children_list */ + context->child_id = j; + /* Actural rank of the peer */ + context->peer = tree->tree_next[j]; + context->con = con; + OBJ_RETAIN(con); + + char *send_buff = context->buff; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Send(start in main): segment %d to %d at buff %p send_count %d tag %d\n", + rank, context->frag_id, context->peer, + (void *) send_buff, send_count, (ibcast_tag << 16) + i)); + err = + MCA_PML_CALL(isend + (send_buff, send_count, datatype, context->peer, + (ibcast_tag << 16) + i, MCA_PML_BASE_SEND_SYNCHRONOUS, comm, + &send_req)); + if (MPI_SUCCESS != err) { + return err; + } + /* Invoke send call back */ + OPAL_THREAD_UNLOCK(mutex); + ompi_request_set_callback(send_req, send_cb, context); + OPAL_THREAD_LOCK(mutex); + } + } + + } + + /* If the current process is not root, it receives data from parent in the tree. */ + else { + /* Handle the situation when num_segs < RECV_NUM */ + if (num_segs <= mca_coll_adapt_component.adapt_ibcast_max_recv_requests) { + min = num_segs; + } else { + min = mca_coll_adapt_component.adapt_ibcast_max_recv_requests; + } + + /* Set recv_array, recv_array is empty */ + for (i = 0; i < num_segs; i++) { + recv_array[i] = 0; + } + /* Set send_array to empty */ + for (i = 0; i < tree->tree_nextsize; i++) { + send_array[i] = 0; + } + + /* Create a recv request */ + ompi_request_t *recv_req; + + /* Recevice some segments from its parent */ + int recv_count = seg_count; + for (i = 0; i < min; i++) { + if (i == (num_segs - 1)) { + recv_count = count - i * seg_count; + } + mca_coll_adapt_bcast_context_t *context = + (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. + adapt_ibcast_context_free_list); + context->buff = (char *) buff + i * real_seg_size; + context->frag_id = i; + context->peer = tree->tree_prev; + context->con = con; + OBJ_RETAIN(con); + char *recv_buff = context->buff; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Recv(start in main): segment %d from %d at buff %p recv_count %d tag %d\n", + ompi_comm_rank(context->con->comm), context->frag_id, + context->peer, (void *) recv_buff, recv_count, + (ibcast_tag << 16) + i)); + err = + MCA_PML_CALL(irecv + (recv_buff, recv_count, datatype, context->peer, + (ibcast_tag << 16) + i, comm, &recv_req)); + if (MPI_SUCCESS != err) { + return err; + } + /* Invoke receive call back */ + OPAL_THREAD_UNLOCK(mutex); + ompi_request_set_callback(recv_req, recv_cb, context); + OPAL_THREAD_LOCK(mutex); + } + + } + + OPAL_THREAD_UNLOCK(mutex); + + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: End of Ibcast\n", rank)); + + return MPI_SUCCESS; +} \ No newline at end of file diff --git a/ompi/mca/coll/adapt/coll_adapt_inbuf.c b/ompi/mca/coll/adapt/coll_adapt_inbuf.c new file mode 100644 index 00000000000..79162966624 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_inbuf.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "coll_adapt.h" +#include "coll_adapt_inbuf.h" + +static void mca_coll_adapt_inbuf_constructor(mca_coll_adapt_inbuf_t * inbuf) +{ +} + +static void mca_coll_adapt_inbuf_destructor(mca_coll_adapt_inbuf_t * inbuf) +{ +} + +OBJ_CLASS_INSTANCE(mca_coll_adapt_inbuf_t, opal_free_list_item_t, mca_coll_adapt_inbuf_constructor, + mca_coll_adapt_inbuf_destructor); diff --git a/ompi/mca/coll/adapt/coll_adapt_inbuf.h b/ompi/mca/coll/adapt/coll_adapt_inbuf.h new file mode 100644 index 00000000000..1d450e59ff7 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_inbuf.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MCA_COLL_ADAPT_INBUF_H +#define MCA_COLL_ADAPT_INBUF_H + +#include "opal/class/opal_free_list.h" + +struct mca_coll_adapt_inbuf_s { + opal_free_list_item_t super; + char buff[1]; +}; + +typedef struct mca_coll_adapt_inbuf_s mca_coll_adapt_inbuf_t; + +OBJ_CLASS_DECLARATION(mca_coll_adapt_inbuf_t); + +#endif /* MCA_COLL_ADAPT_INBUF_H */ diff --git a/ompi/mca/coll/adapt/coll_adapt_ireduce.c b/ompi/mca/coll/adapt/coll_adapt_ireduce.c new file mode 100644 index 00000000000..d99bb87f998 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_ireduce.c @@ -0,0 +1,935 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "ompi/communicator/communicator.h" +#include "coll_adapt.h" +#include "coll_adapt_algorithms.h" +#include "coll_adapt_context.h" +#include "coll_adapt_item.h" +#include "ompi/constants.h" +#include "ompi/mca/coll/coll.h" +#include "ompi/mca/coll/base/coll_tags.h" +#include "ompi/mca/pml/pml.h" +#include "ompi/mca/coll/base/coll_base_functions.h" +#include "ompi/mca/coll/base/coll_base_topo.h" + +/* MPI_Reduce and MPI_Ireduce in the ADAPT module only work for commutative operations */ + +typedef int (*mca_coll_adapt_ireduce_fn_t) (const void *sbuf, + void *rbuf, + int count, + struct ompi_datatype_t * datatype, + struct ompi_op_t * op, + int root, + struct ompi_communicator_t * comm, + ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag); + +static mca_coll_adapt_algorithm_index_t mca_coll_adapt_ireduce_algorithm_index[] = { + {1, (uintptr_t) mca_coll_adapt_ireduce_binomial}, + {2, (uintptr_t) mca_coll_adapt_ireduce_in_order_binomial}, + {3, (uintptr_t) mca_coll_adapt_ireduce_binary}, + {4, (uintptr_t) mca_coll_adapt_ireduce_pipeline}, + {5, (uintptr_t) mca_coll_adapt_ireduce_chain}, + {6, (uintptr_t) mca_coll_adapt_ireduce_linear}, +}; + +/* + * Set up MCA parameters of MPI_Reduce and MPI_Ireduce + */ +int mca_coll_adapt_ireduce_init(void) +{ + mca_base_component_t *c = &mca_coll_adapt_component.super.collm_version; + + mca_coll_adapt_component.adapt_ireduce_algorithm = 1; + mca_base_component_var_register(c, "reduce_algorithm", + "Algorithm of reduce, 1: binomial, 2: in_order_binomial, 3: binary, 4: pipeline, 5: chain, 6: linear", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_ireduce_algorithm); + + mca_coll_adapt_component.adapt_ireduce_segment_size = 163740; + mca_base_component_var_register(c, "reduce_segment_size", + "Segment size in bytes used by default for reduce algorithms. Only has meaning if algorithm is forced and supports segmenting. 0 bytes means no segmentation.", + MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_ireduce_segment_size); + + mca_coll_adapt_component.adapt_ireduce_max_send_requests = 2; + mca_base_component_var_register(c, "reduce_max_send_requests", + "Maximum number of send requests", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_ireduce_max_send_requests); + + mca_coll_adapt_component.adapt_ireduce_max_recv_requests = 3; + mca_base_component_var_register(c, "reduce_max_recv_requests", + "Maximum number of receive requests", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_ireduce_max_recv_requests); + + mca_coll_adapt_component.adapt_inbuf_free_list_min = 10; + mca_base_component_var_register(c, "inbuf_free_list_min", + "Minimum number of segment in inbuf free list", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_inbuf_free_list_min); + + mca_coll_adapt_component.adapt_inbuf_free_list_max = 10000; + mca_base_component_var_register(c, "inbuf_free_list_max", + "Maximum number of segment in inbuf free list", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_inbuf_free_list_max); + + + mca_coll_adapt_component.adapt_inbuf_free_list_inc = 10; + mca_base_component_var_register(c, "inbuf_free_list_inc", + "Maximum number of segment in inbuf free list", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_coll_adapt_component.adapt_inbuf_free_list_inc); + + mca_coll_adapt_component.adapt_ireduce_context_free_list = NULL; + mca_coll_adapt_component.adapt_ireduce_context_free_list_enabled = 0; + return OMPI_SUCCESS; +} + +/* + * Release the free list created in mca_coll_adapt_ireduce_generic + */ +int mca_coll_adapt_ireduce_fini(void) +{ + if (NULL != mca_coll_adapt_component.adapt_ireduce_context_free_list) { + OBJ_RELEASE(mca_coll_adapt_component.adapt_ireduce_context_free_list); + mca_coll_adapt_component.adapt_ireduce_context_free_list = NULL; + mca_coll_adapt_component.adapt_ireduce_context_free_list_enabled = 0; + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "ireduce fini\n")); + } + return OMPI_SUCCESS; +} + +/* + * Functions to access list + */ +static mca_coll_adapt_item_t *get_next_ready_item(opal_list_t * list, int num_children) +{ + mca_coll_adapt_item_t *item; + if (opal_list_is_empty(list)) { + return NULL; + } + for (item = (mca_coll_adapt_item_t *) opal_list_get_first(list); + item != (mca_coll_adapt_item_t *) opal_list_get_end(list); + item = (mca_coll_adapt_item_t *) ((opal_list_item_t *) item)->opal_list_next) { + if (item->count == num_children) { + opal_list_remove_item(list, (opal_list_item_t *) item); + return item; + } + } + return NULL; +} + +static int add_to_list(opal_list_t * list, int id) +{ + mca_coll_adapt_item_t *item; + int ret = 0; + for (item = (mca_coll_adapt_item_t *) opal_list_get_first(list); + item != (mca_coll_adapt_item_t *) opal_list_get_end(list); + item = (mca_coll_adapt_item_t *) ((opal_list_item_t *) item)->opal_list_next) { + if (item->id == id) { + (item->count)++; + ret = 1; + break; + } + } + if (ret == 0) { + item = OBJ_NEW(mca_coll_adapt_item_t); + item->id = id; + item->count = 1; + opal_list_append(list, (opal_list_item_t *) item); + ret = 2; + } + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "add_to_list_return %d\n", + ret)); + return ret; +} + +/* + * Get the inbuf address + */ +static mca_coll_adapt_inbuf_t *to_inbuf(char *buf, int distance) +{ + return (mca_coll_adapt_inbuf_t *) (buf - distance); +} + +/* + * Finish a ireduce request + */ +static int ireduce_request_fini(mca_coll_adapt_reduce_context_t * context) +{ + /* Return the allocated recourses */ + int i; + ompi_request_t *temp_req = context->con->request; + if (context->con->accumbuf != NULL) { + if (context->con->rank != context->con->root) { + for (i = 0; i < context->con->num_segs; i++) { + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: Return accumbuf %d %p\n", + ompi_comm_rank(context->con->comm), i, + (void *) to_inbuf(context->con->accumbuf[i], + context->con->distance))); + opal_free_list_return(context->con->inbuf_list, + (opal_free_list_item_t *) to_inbuf(context->con->accumbuf[i], + context->con->distance)); + } + } + free(context->con->accumbuf); + } + OBJ_RELEASE(context->con->recv_list); + for (i = 0; i < context->con->num_segs; i++) { + OBJ_RELEASE(context->con->mutex_op_list[i]); + } + free(context->con->mutex_op_list); + OBJ_RELEASE(context->con->mutex_num_recv_segs); + OBJ_RELEASE(context->con->mutex_recv_list); + OBJ_RELEASE(context->con->mutex_num_sent); + if (context->con->tree->tree_nextsize > 0) { + OBJ_RELEASE(context->con->inbuf_list); + free(context->con->next_recv_segs); + } + OBJ_RELEASE(context->con); + OBJ_RELEASE(context->con); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "return context_list\n")); + opal_free_list_return(mca_coll_adapt_component.adapt_ireduce_context_free_list, + (opal_free_list_item_t *) context); + /* Complete the request */ + ompi_request_complete(temp_req, 1); + return OMPI_SUCCESS; +} + +/* + * Callback function of isend + */ +static int send_cb(ompi_request_t * req) +{ + mca_coll_adapt_reduce_context_t *context = + (mca_coll_adapt_reduce_context_t *) req->req_complete_cb_data; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: ireduce_send_cb, peer %d, seg_id %d\n", context->con->rank, + context->peer, context->frag_id)); + int err; + + opal_atomic_sub_fetch_32(&(context->con->ongoing_send), 1); + + /* Send a new segment */ + OPAL_THREAD_LOCK(context->con->mutex_recv_list); + mca_coll_adapt_item_t *item = + get_next_ready_item(context->con->recv_list, context->con->tree->tree_nextsize); + OPAL_THREAD_UNLOCK(context->con->mutex_recv_list); + + if (item != NULL) { + /* Get new context item from free list */ + mca_coll_adapt_reduce_context_t *send_context = + (mca_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. + adapt_ireduce_context_free_list); + if (context->con->tree->tree_nextsize > 0) { + send_context->buff = context->con->accumbuf[item->id]; + + } else { + send_context->buff = + context->buff + (item->id - context->frag_id) * context->con->segment_increment; + } + send_context->frag_id = item->id; + send_context->peer = context->peer; + send_context->con = context->con; + OBJ_RETAIN(context->con); + + opal_atomic_add_fetch_32(&(context->con->ongoing_send), 1); + + int send_count = send_context->con->seg_count; + if (item->id == (send_context->con->num_segs - 1)) { + send_count = send_context->con->count - item->id * send_context->con->seg_count; + } + + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In send_cb, create isend to seg %d, peer %d, tag %d\n", + send_context->con->rank, send_context->frag_id, send_context->peer, + (send_context->con->ireduce_tag << 16) + send_context->frag_id)); + + ompi_request_t *send_req; + err = + MCA_PML_CALL(isend + (send_context->buff, send_count, send_context->con->datatype, + send_context->peer, + (context->con->ireduce_tag << 16) + send_context->frag_id, + MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); + if (MPI_SUCCESS != err) { + return err; + } + + /* Release the item */ + OBJ_RELEASE(item); + + /* Invoke send call back */ + ompi_request_set_callback(send_req, send_cb, send_context); + } + + OPAL_THREAD_LOCK(context->con->mutex_num_sent); + int32_t num_sent = ++(context->con->num_sent_segs); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In send_cb, root = %d, num_sent = %d, num_segs = %d\n", + context->con->rank, context->con->tree->tree_root, num_sent, + context->con->num_segs)); + /* Check whether signal the condition, non root and sent all the segments */ + if (context->con->tree->tree_root != context->con->rank && num_sent == context->con->num_segs) { + OPAL_THREAD_UNLOCK(context->con->mutex_num_sent); + ireduce_request_fini(context); + } else { + OPAL_THREAD_UNLOCK(context->con->mutex_num_sent); + OBJ_RELEASE(context->con); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "return context_list\n")); + opal_free_list_return(mca_coll_adapt_component.adapt_ireduce_context_free_list, + (opal_free_list_item_t *) context); + } + /* Call back function return 1, which means successful */ + req->req_free(&req); + return 1; +} + +/* + * Callback function of irecv + */ +static int recv_cb(ompi_request_t * req) +{ + mca_coll_adapt_reduce_context_t *context = + (mca_coll_adapt_reduce_context_t *) req->req_complete_cb_data; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: ireduce_recv_cb, peer %d, seg_id %d\n", context->con->rank, + context->peer, context->frag_id)); + + int err; + int32_t new_id = + opal_atomic_add_fetch_32(&(context->con->next_recv_segs[context->child_id]), 1); + + /* Receive new segment */ + if (new_id < context->con->num_segs) { + char *temp_recv_buf = NULL; + mca_coll_adapt_inbuf_t *inbuf = NULL; + /* Set inbuf, if it it first child, recv on rbuf, else recv on inbuf */ + if (context->child_id == 0 && context->con->sbuf != MPI_IN_PLACE + && context->con->root == context->con->rank) { + temp_recv_buf = + (char *) context->con->rbuf + + (ptrdiff_t) new_id *(ptrdiff_t) context->con->segment_increment; + } else { + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In recv_cb, alloc inbuf\n", context->con->rank)); + inbuf = (mca_coll_adapt_inbuf_t *) opal_free_list_wait(context->con->inbuf_list); + temp_recv_buf = inbuf->buff - context->con->lower_bound; + } + /* Get new context item from free list */ + mca_coll_adapt_reduce_context_t *recv_context = + (mca_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. + adapt_ireduce_context_free_list); + recv_context->buff = temp_recv_buf; + recv_context->frag_id = new_id; + recv_context->child_id = context->child_id; + recv_context->peer = context->peer; + recv_context->con = context->con; + OBJ_RETAIN(context->con); + recv_context->inbuf = inbuf; + int recv_count = recv_context->con->seg_count; + if (new_id == (recv_context->con->num_segs - 1)) { + recv_count = recv_context->con->count - new_id * recv_context->con->seg_count; + } + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In recv_cb, create irecv for seg %d, peer %d, inbuf %p, tag %d\n", + context->con->rank, recv_context->frag_id, recv_context->peer, + (void *) inbuf, + (recv_context->con->ireduce_tag << 16) + recv_context->frag_id)); + ompi_request_t *recv_req; + err = + MCA_PML_CALL(irecv + (temp_recv_buf, recv_count, recv_context->con->datatype, + recv_context->peer, + (recv_context->con->ireduce_tag << 16) + recv_context->frag_id, + recv_context->con->comm, &recv_req)); + if (MPI_SUCCESS != err) { + return err; + } + /* Invoke recvive call back */ + ompi_request_set_callback(recv_req, recv_cb, recv_context); + } + + /* Do the op */ + int op_count = context->con->seg_count; + if (context->frag_id == (context->con->num_segs - 1)) { + op_count = context->con->count - context->frag_id * context->con->seg_count; + } + + int keep_inbuf = 0; + OPAL_THREAD_LOCK(context->con->mutex_op_list[context->frag_id]); + if (context->con->accumbuf[context->frag_id] == NULL) { + if (context->inbuf == NULL) { + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: set accumbuf to rbuf\n", context->con->rank)); + context->con->accumbuf[context->frag_id] = context->buff; + } else { + keep_inbuf = 1; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: set accumbuf to inbuf\n", context->con->rank)); + context->con->accumbuf[context->frag_id] = + context->inbuf->buff - context->con->lower_bound; + } + /* Op sbuf and accmbuf to accumbuf */ + ompi_op_reduce(context->con->op, + context->con->sbuf + + (ptrdiff_t) context->frag_id * (ptrdiff_t) context->con->segment_increment, + context->con->accumbuf[context->frag_id], op_count, context->con->datatype); + + } else { + if (context->inbuf == NULL) { + /* Op rbuf and accumbuf to rbuf */ + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: op rbuf and accumbuf to rbuf\n", context->con->rank)); + ompi_op_reduce(context->con->op, context->con->accumbuf[context->frag_id], + context->buff, op_count, context->con->datatype); + /* Free old accumbuf */ + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: free old accumbuf %p\n", context->con->rank, + (void *) to_inbuf(context->con->accumbuf[context->frag_id], + context->con->distance))); + opal_free_list_return(context->con->inbuf_list, + (opal_free_list_item_t *) to_inbuf(context->con-> + accumbuf[context->frag_id], + context->con->distance)); + /* Set accumbut to rbuf */ + context->con->accumbuf[context->frag_id] = context->buff; + } else { + /* Op inbuf and accmbuf to accumbuf */ + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: op inbuf and accmbuf to accumbuf\n", context->con->rank)); + ompi_op_reduce(context->con->op, context->inbuf->buff - context->con->lower_bound, + context->con->accumbuf[context->frag_id], op_count, + context->con->datatype); + } + } + + OPAL_THREAD_UNLOCK(context->con->mutex_op_list[context->frag_id]); + + /* Set recv list */ + if (context->con->rank != context->con->tree->tree_root) { + OPAL_THREAD_LOCK(context->con->mutex_recv_list); + add_to_list(context->con->recv_list, context->frag_id); + OPAL_THREAD_UNLOCK(context->con->mutex_recv_list); + } + + /* Send to parent */ + if (context->con->rank != context->con->tree->tree_root + && context->con->ongoing_send < mca_coll_adapt_component.adapt_ireduce_max_send_requests) { + OPAL_THREAD_LOCK(context->con->mutex_recv_list); + mca_coll_adapt_item_t *item = + get_next_ready_item(context->con->recv_list, context->con->tree->tree_nextsize); + OPAL_THREAD_UNLOCK(context->con->mutex_recv_list); + + if (item != NULL) { + /* Gt new context item from free list */ + mca_coll_adapt_reduce_context_t *send_context = + (mca_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. + adapt_ireduce_context_free_list); + send_context->buff = context->con->accumbuf[context->frag_id]; + send_context->frag_id = item->id; + send_context->peer = context->con->tree->tree_prev; + send_context->con = context->con; + OBJ_RETAIN(context->con); + opal_atomic_add_fetch_32(&(context->con->ongoing_send), 1); + + int send_count = send_context->con->seg_count; + if (item->id == (send_context->con->num_segs - 1)) { + send_count = send_context->con->count - item->id * send_context->con->seg_count; + } + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In recv_cb, create isend to seg %d, peer %d, tag %d\n", + send_context->con->rank, send_context->frag_id, send_context->peer, + (send_context->con->ireduce_tag << 16) + send_context->frag_id)); + + ompi_request_t *send_req; + err = + MCA_PML_CALL(isend + (send_context->buff, send_count, send_context->con->datatype, + send_context->peer, + (send_context->con->ireduce_tag << 16) + send_context->frag_id, + MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); + if (MPI_SUCCESS != err) { + return err; + } + OBJ_RELEASE(item); + + /* Invoke send call back */ + ompi_request_set_callback(send_req, send_cb, send_context); + } + } + + OPAL_THREAD_LOCK(context->con->mutex_num_recv_segs); + int num_recv_segs_t = ++(context->con->num_recv_segs); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In recv_cb, tree = %p, root = %d, num_recv = %d, num_segs = %d, num_child = %d\n", + context->con->rank, (void *) context->con->tree, + context->con->tree->tree_root, num_recv_segs_t, context->con->num_segs, + context->con->tree->tree_nextsize)); + /* If this is root and has received all the segments */ + if (context->con->tree->tree_root == context->con->rank + && num_recv_segs_t == context->con->num_segs * context->con->tree->tree_nextsize) { + OPAL_THREAD_UNLOCK(context->con->mutex_num_recv_segs); + if (!keep_inbuf && context->inbuf != NULL) { + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: root free context inbuf %p", context->con->rank, + (void *) context->inbuf)); + opal_free_list_return(context->con->inbuf_list, + (opal_free_list_item_t *) context->inbuf); + } + ireduce_request_fini(context); + } else { + OPAL_THREAD_UNLOCK(context->con->mutex_num_recv_segs); + if (!keep_inbuf && context->inbuf != NULL) { + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: free context inbuf %p", context->con->rank, + (void *) context->inbuf)); + opal_free_list_return(context->con->inbuf_list, + (opal_free_list_item_t *) context->inbuf); + } + OBJ_RELEASE(context->con); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: return context_list", + context->con->rank)); + opal_free_list_return(mca_coll_adapt_component.adapt_ireduce_context_free_list, + (opal_free_list_item_t *) context); + } + req->req_free(&req); + return 1; +} + +int mca_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, + struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module) +{ + if (count == 0) { + return MPI_SUCCESS; + } else { + int rank = ompi_comm_rank(comm); + if (rank == root) { + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, + "ireduce root %d, algorithm %d, coll_adapt_ireduce_segment_size %zu, coll_adapt_ireduce_max_send_requests %d, coll_adapt_ireduce_max_recv_requests %d\n", + root, mca_coll_adapt_component.adapt_ireduce_algorithm, + mca_coll_adapt_component.adapt_ireduce_segment_size, + mca_coll_adapt_component.adapt_ireduce_max_send_requests, + mca_coll_adapt_component.adapt_ireduce_max_recv_requests)); + } + /* Get ireduce tag */ + int ireduce_tag = opal_atomic_add_fetch_32(&(comm->c_ireduce_tag), 1); + ireduce_tag = (ireduce_tag % 4096) + 4096; + fflush(stdout); + mca_coll_adapt_ireduce_fn_t reduce_func = + (mca_coll_adapt_ireduce_fn_t) + mca_coll_adapt_ireduce_algorithm_index[mca_coll_adapt_component. + adapt_ireduce_algorithm].algorithm_fn_ptr; + return reduce_func(sbuf, rbuf, count, dtype, op, root, comm, request, module, ireduce_tag); + } +} + +/* + * Ireduce functions with different algorithms + */ +int mca_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_bmtree(comm, root); + int err = + mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + tree, mca_coll_adapt_component.adapt_ireduce_segment_size, + ireduce_tag); + return err; +} + +int mca_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_in_order_bmtree(comm, root); + int err = + mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + tree, mca_coll_adapt_component.adapt_ireduce_segment_size, + ireduce_tag); + return err; +} + +int mca_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_tree(2, comm, root); + int err = + mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + tree, mca_coll_adapt_component.adapt_ireduce_segment_size, + ireduce_tag); + return err; +} + +int mca_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(1, comm, root); + int err = + mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + tree, mca_coll_adapt_component.adapt_ireduce_segment_size, + ireduce_tag); + return err; +} + + +int mca_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag) +{ + ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(4, comm, root); + int err = + mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + tree, mca_coll_adapt_component.adapt_ireduce_segment_size, + ireduce_tag); + return err; +} + +int mca_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, int ireduce_tag) +{ + int fanout = ompi_comm_size(comm) - 1; + ompi_coll_tree_t *tree; + if (fanout < 1) { + tree = ompi_coll_base_topo_build_chain(1, comm, root); + } else if (fanout <= MAXTREEFANOUT) { + tree = ompi_coll_base_topo_build_tree(ompi_comm_size(comm) - 1, comm, root); + } else { + tree = ompi_coll_base_topo_build_tree(MAXTREEFANOUT, comm, root); + } + int err = + mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + tree, mca_coll_adapt_component.adapt_ireduce_segment_size, + ireduce_tag); + return err; +} + + +int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, ompi_coll_tree_t * tree, + size_t seg_size, int ireduce_tag) +{ + + ptrdiff_t extent, lower_bound, segment_increment; + ptrdiff_t true_lower_bound, true_extent, real_seg_size; + size_t typelng; + int seg_count = count, num_segs, rank, recv_count, send_count, i, j, err, min, distance = 0; + int32_t seg_index; + _Atomic int *next_recv_segs = NULL; + /* Used to store the accumuate result, pointer to every segment */ + char **accumbuf = NULL; + /* A free list contains all recv data */ + opal_free_list_t *inbuf_list; + opal_mutex_t *mutex_recv_list; + opal_mutex_t *mutex_num_recv_segs; + opal_mutex_t *mutex_num_sent; + opal_mutex_t **mutex_op_list; + /* A list to store the segments need to be sent */ + opal_list_t *recv_list; + + /* Determine number of segments and number of elements sent per operation */ + rank = ompi_comm_rank(comm); + ompi_datatype_get_extent(dtype, &lower_bound, &extent); + ompi_datatype_type_size(dtype, &typelng); + COLL_BASE_COMPUTED_SEGCOUNT(seg_size, typelng, seg_count); + num_segs = (count + seg_count - 1) / seg_count; + segment_increment = (ptrdiff_t) seg_count *extent; + ompi_datatype_get_true_extent(dtype, &true_lower_bound, &true_extent); + real_seg_size = true_extent + (ptrdiff_t) (seg_count - 1) * extent; + + /* Set up free list */ + if (0 == mca_coll_adapt_component.adapt_ireduce_context_free_list_enabled) { + int32_t context_free_list_enabled = + opal_atomic_add_fetch_32(& + (mca_coll_adapt_component. + adapt_ireduce_context_free_list_enabled), 1); + if (1 == context_free_list_enabled) { + mca_coll_adapt_component.adapt_ireduce_context_free_list = OBJ_NEW(opal_free_list_t); + opal_free_list_init(mca_coll_adapt_component.adapt_ireduce_context_free_list, + sizeof(mca_coll_adapt_reduce_context_t), + opal_cache_line_size, + OBJ_CLASS(mca_coll_adapt_reduce_context_t), + 0, opal_cache_line_size, + mca_coll_adapt_component.adapt_context_free_list_min, + mca_coll_adapt_component.adapt_context_free_list_max, + mca_coll_adapt_component.adapt_context_free_list_inc, + NULL, 0, NULL, NULL, NULL); + } + } + + /* If the current process is not leaf */ + if (tree->tree_nextsize > 0) { + inbuf_list = OBJ_NEW(opal_free_list_t); + opal_free_list_init(inbuf_list, + sizeof(mca_coll_adapt_inbuf_t) + real_seg_size, + opal_cache_line_size, + OBJ_CLASS(mca_coll_adapt_inbuf_t), + 0, opal_cache_line_size, + mca_coll_adapt_component.adapt_inbuf_free_list_min, + mca_coll_adapt_component.adapt_inbuf_free_list_max, + mca_coll_adapt_component.adapt_inbuf_free_list_inc, + NULL, 0, NULL, NULL, NULL); + /* Set up next_recv_segs */ + next_recv_segs = (_Atomic int32_t *) malloc(sizeof(int32_t) * tree->tree_nextsize); + mca_coll_adapt_inbuf_t *temp_inbuf = + (mca_coll_adapt_inbuf_t *) opal_free_list_wait(inbuf_list); + distance = (char *) temp_inbuf->buff - lower_bound - (char *) temp_inbuf; //address of inbuf->buff to address of inbuf + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: distance %d, inbuf %p, inbuf->buff %p, inbuf->buff-lb %p, to_inbuf %p, inbuf_list %p\n", + rank, distance, (void *) temp_inbuf, (void *) temp_inbuf->buff, + (char *) temp_inbuf->buff - lower_bound, + (void *) to_inbuf((char *) temp_inbuf->buff - lower_bound, distance), + (void *) inbuf_list)); + opal_free_list_return(inbuf_list, (opal_free_list_item_t *) temp_inbuf); + } else { + inbuf_list = NULL; + next_recv_segs = NULL; + } + + ompi_request_t *temp_request = NULL; + /* Set up request */ + temp_request = OBJ_NEW(ompi_request_t); + OMPI_REQUEST_INIT(temp_request, false); + temp_request->req_state = OMPI_REQUEST_ACTIVE; + temp_request->req_type = 0; + temp_request->req_free = adapt_request_free; + temp_request->req_status.MPI_SOURCE = 0; + temp_request->req_status.MPI_TAG = 0; + temp_request->req_status.MPI_ERROR = 0; + temp_request->req_status._cancelled = 0; + temp_request->req_status._ucount = 0; + *request = temp_request; + + /* Set up mutex */ + mutex_recv_list = OBJ_NEW(opal_mutex_t); + mutex_num_recv_segs = OBJ_NEW(opal_mutex_t); + mutex_op_list = (opal_mutex_t **) malloc(sizeof(opal_mutex_t *) * num_segs); + for (i = 0; i < num_segs; i++) { + mutex_op_list[i] = OBJ_NEW(opal_mutex_t); + } + mutex_num_sent = OBJ_NEW(opal_mutex_t); + /* Create recv_list */ + recv_list = OBJ_NEW(opal_list_t); + + /* Set constant context for send and recv call back */ + mca_coll_adapt_constant_reduce_context_t *con = + OBJ_NEW(mca_coll_adapt_constant_reduce_context_t); + con->count = count; + con->seg_count = seg_count; + con->datatype = dtype; + con->comm = comm; + con->segment_increment = segment_increment; + con->num_segs = num_segs; + con->request = temp_request; + con->rank = rank; + con->num_recv_segs = 0; + con->num_sent_segs = 0; + con->next_recv_segs = next_recv_segs; + con->mutex_recv_list = mutex_recv_list; + con->mutex_num_recv_segs = mutex_num_recv_segs; + con->mutex_num_sent = mutex_num_sent; + con->mutex_op_list = mutex_op_list; + con->op = op; + con->tree = tree; + con->inbuf_list = inbuf_list; + con->recv_list = recv_list; + con->lower_bound = lower_bound; + con->ongoing_send = 0; + con->sbuf = (char *) sbuf; + con->rbuf = (char *) rbuf; + con->root = root; + con->distance = distance; + con->ireduce_tag = ireduce_tag; + con->real_seg_size = real_seg_size; + + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: start ireduce root %d tag %d\n", rank, tree->tree_root, + ireduce_tag)); + + /* If the current process is not leaf node */ + if (tree->tree_nextsize > 0) { + /* Set up accumbuf */ + accumbuf = (char **) malloc(sizeof(char *) * num_segs); + if (root == rank && sbuf == MPI_IN_PLACE) { + for (i = 0; i < num_segs; i++) { + accumbuf[i] = (char *) rbuf + (ptrdiff_t) i *(ptrdiff_t) segment_increment; + } + } else { + for (i = 0; i < num_segs; i++) { + accumbuf[i] = NULL; + } + } + + con->accumbuf = accumbuf; + + /* For the first batch of segments */ + if (num_segs <= mca_coll_adapt_component.adapt_ireduce_max_recv_requests) { + min = num_segs; + } else { + min = mca_coll_adapt_component.adapt_ireduce_max_recv_requests; + } + for (i = 0; i < tree->tree_nextsize; i++) { + next_recv_segs[i] = min - 1; + } + + for (j = 0; j < min; j++) { + /* For each child */ + for (i = 0; i < tree->tree_nextsize; i++) { + seg_index = j; + if (seg_index < num_segs) { + recv_count = seg_count; + if (seg_index == (num_segs - 1)) { + recv_count = count - (ptrdiff_t) seg_count *(ptrdiff_t) seg_index; + } + char *temp_recv_buf = NULL; + mca_coll_adapt_inbuf_t *inbuf = NULL; + /* Set inbuf, if it it first child, recv on rbuf, else recv on inbuf */ + if (i == 0 && sbuf != MPI_IN_PLACE && root == rank) { + temp_recv_buf = + (char *) rbuf + (ptrdiff_t) j *(ptrdiff_t) segment_increment; + } else { + inbuf = (mca_coll_adapt_inbuf_t *) opal_free_list_wait(inbuf_list); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In ireduce, alloc inbuf %p\n", rank, + (void *) inbuf)); + temp_recv_buf = inbuf->buff - lower_bound; + } + /* Get context */ + mca_coll_adapt_reduce_context_t *context = + (mca_coll_adapt_reduce_context_t *) + opal_free_list_wait(mca_coll_adapt_component. + adapt_ireduce_context_free_list); + context->buff = temp_recv_buf; + context->frag_id = seg_index; + context->child_id = i; //the id of peer in in the tree + context->peer = tree->tree_next[i]; //the actural rank of the peer + context->con = con; + OBJ_RETAIN(con); + context->inbuf = inbuf; + + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In ireduce, create irecv for seg %d, peer %d, recv_count %d, inbuf %p tag %d\n", + context->con->rank, context->frag_id, context->peer, + recv_count, (void *) inbuf, + (ireduce_tag << 16) + seg_index)); + + /* Create a recv request */ + ompi_request_t *recv_req; + err = + MCA_PML_CALL(irecv + (temp_recv_buf, recv_count, dtype, tree->tree_next[i], + (ireduce_tag << 16) + seg_index, comm, &recv_req)); + if (MPI_SUCCESS != err) { + return err; + } + /* Invoke recv call back */ + ompi_request_set_callback(recv_req, recv_cb, context); + } + } + } + } + + /* Leaf nodes */ + else { + mca_coll_adapt_item_t *item; + /* Set up recv_list */ + for (seg_index = 0; seg_index < num_segs; seg_index++) { + item = OBJ_NEW(mca_coll_adapt_item_t); + item->id = seg_index; + item->count = tree->tree_nextsize; + opal_list_append(recv_list, (opal_list_item_t *) item); + } + if (num_segs <= mca_coll_adapt_component.adapt_ireduce_max_send_requests) { + min = num_segs; + } else { + min = mca_coll_adapt_component.adapt_ireduce_max_send_requests; + } + con->accumbuf = accumbuf; + for (i = 0; i < min; i++) { + OPAL_THREAD_LOCK(mutex_recv_list); + item = get_next_ready_item(recv_list, tree->tree_nextsize); + OPAL_THREAD_UNLOCK(mutex_recv_list); + if (item != NULL) { + send_count = seg_count; + if (item->id == (num_segs - 1)) { + send_count = count - (ptrdiff_t) seg_count *(ptrdiff_t) item->id; + } + mca_coll_adapt_reduce_context_t *context = + (mca_coll_adapt_reduce_context_t *) + opal_free_list_wait(mca_coll_adapt_component.adapt_ireduce_context_free_list); + context->buff = + (char *) sbuf + (ptrdiff_t) item->id * (ptrdiff_t) segment_increment; + context->frag_id = item->id; + /* Actural rank of the peer */ + context->peer = tree->tree_prev; + context->con = con; + OBJ_RETAIN(con); + context->inbuf = NULL; + + opal_atomic_add_fetch_32(&(context->con->ongoing_send), 1); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, + "[%d]: In ireduce, create isend to seg %d, peer %d, send_count %d tag %d\n", + context->con->rank, context->frag_id, context->peer, + send_count, (ireduce_tag << 16) + context->frag_id)); + + /* Create send request */ + ompi_request_t *send_req; + err = + MCA_PML_CALL(isend + (context->buff, send_count, dtype, tree->tree_prev, + (ireduce_tag << 16) + context->frag_id, + MCA_PML_BASE_SEND_SYNCHRONOUS, comm, &send_req)); + if (MPI_SUCCESS != err) { + return err; + } + OBJ_RELEASE(item); + + /* Invoke send call back */ + ompi_request_set_callback(send_req, send_cb, context); + } + } + + } + + return MPI_SUCCESS; +} diff --git a/ompi/mca/coll/adapt/coll_adapt_item.c b/ompi/mca/coll/adapt/coll_adapt_item.c new file mode 100644 index 00000000000..dabe2ce37b8 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_item.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "coll_adapt_item.h" + +static void mca_coll_adapt_item_constructor(mca_coll_adapt_item_t * item) +{ +} + +static void mca_coll_adapt_item_destructor(mca_coll_adapt_item_t * item) +{ +} + +OBJ_CLASS_INSTANCE(mca_coll_adapt_item_t, opal_list_item_t, mca_coll_adapt_item_constructor, + mca_coll_adapt_item_destructor); diff --git a/ompi/mca/coll/adapt/coll_adapt_item.h b/ompi/mca/coll/adapt/coll_adapt_item.h new file mode 100644 index 00000000000..2fc6cbdbd03 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_item.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal/class/opal_list.h" +#include "coll_adapt_inbuf.h" + +struct mca_coll_adapt_item_s { + opal_list_item_t super; + /* Fragment id */ + int id; + /* The number of children which have received the current segment from */ + int count; +}; + +typedef struct mca_coll_adapt_item_s mca_coll_adapt_item_t; + +OBJ_CLASS_DECLARATION(mca_coll_adapt_item_t); diff --git a/ompi/mca/coll/adapt/coll_adapt_module.c b/ompi/mca/coll/adapt/coll_adapt_module.c new file mode 100644 index 00000000000..e709313361f --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_module.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_SCHED_H +#include +#endif +#include +#ifdef HAVE_SYS_MMAN_H +#include +#endif /* HAVE_SYS_MMAN_H */ +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + +#include "mpi.h" +#include "opal_stdint.h" +#include "opal/util/os_path.h" + +#include "ompi/communicator/communicator.h" +#include "ompi/group/group.h" +#include "ompi/mca/coll/coll.h" +#include "ompi/mca/coll/base/base.h" +#include "ompi/mca/coll/base/coll_base_functions.h" +//#include "ompi/mca/rte/rte.h" +#include "ompi/proc/proc.h" +#include "coll_adapt.h" + +#include "ompi/mca/coll/base/coll_tags.h" +#include "ompi/mca/pml/pml.h" +#include "coll_adapt_algorithms.h" + + +/* + * Local functions + */ +static int adapt_module_enable(mca_coll_base_module_t * module, struct ompi_communicator_t *comm); + +/* + * Module constructor + */ +static void mca_coll_adapt_module_construct(mca_coll_adapt_module_t * module) +{ + module->enabled = false; + module->adapt_component = &mca_coll_adapt_component; +} + +/* + * Module destructor + */ +static void mca_coll_adapt_module_destruct(mca_coll_adapt_module_t * module) +{ + module->enabled = false; +} + + +OBJ_CLASS_INSTANCE(mca_coll_adapt_module_t, + mca_coll_base_module_t, + mca_coll_adapt_module_construct, mca_coll_adapt_module_destruct); + +/* + * Initial query function that is invoked during MPI_INIT, allowing + * this component to disqualify itself if it doesn't support the + * required level of thread support. This function is invoked exactly + * once. + */ +int mca_coll_adapt_init_query(bool enable_progress_threads, bool enable_mpi_threads) +{ + return OMPI_SUCCESS; +} + + +/* + * Invoked when there's a new communicator that has been created. + * Look at the communicator and decide which set of functions and + * priority we want to return. + */ +mca_coll_base_module_t *mca_coll_adapt_comm_query(struct ompi_communicator_t * comm, int *priority) +{ + mca_coll_adapt_module_t *adapt_module; + + /* If we're intercomm, or if there's only one process in the communicator */ + if (OMPI_COMM_IS_INTER(comm) || 1 == ompi_comm_size(comm)) { + opal_output_verbose(10, ompi_coll_base_framework.framework_output, + "coll:adapt:comm_query (%d/%s): intercomm, comm is too small; disqualifying myself", + comm->c_contextid, comm->c_name); + return NULL; + } + + /* Get the priority level attached to this module. If priority is less than or equal to 0, then the module is unavailable. */ + *priority = mca_coll_adapt_component.adapt_priority; + if (mca_coll_adapt_component.adapt_priority <= 0) { + opal_output_verbose(10, ompi_coll_base_framework.framework_output, + "coll:adapt:comm_query (%d/%s): priority too low; disqualifying myself", + comm->c_contextid, comm->c_name); + return NULL; + } + + adapt_module = OBJ_NEW(mca_coll_adapt_module_t); + if (NULL == adapt_module) { + return NULL; + } + + /* All is good -- return a module */ + adapt_module->super.coll_module_enable = adapt_module_enable; + adapt_module->super.ft_event = NULL; + adapt_module->super.coll_allgather = NULL; + adapt_module->super.coll_allgatherv = NULL; + adapt_module->super.coll_allreduce = NULL; + adapt_module->super.coll_alltoall = NULL; + adapt_module->super.coll_alltoallw = NULL; + adapt_module->super.coll_barrier = NULL; + adapt_module->super.coll_bcast = mca_coll_adapt_bcast; + adapt_module->super.coll_exscan = NULL; + adapt_module->super.coll_gather = NULL; + adapt_module->super.coll_gatherv = NULL; + adapt_module->super.coll_reduce = mca_coll_adapt_reduce; + adapt_module->super.coll_reduce_scatter = NULL; + adapt_module->super.coll_scan = NULL; + adapt_module->super.coll_scatter = NULL; + adapt_module->super.coll_scatterv = NULL; + adapt_module->super.coll_ibcast = mca_coll_adapt_ibcast; + adapt_module->super.coll_ireduce = mca_coll_adapt_ireduce; + adapt_module->super.coll_iallreduce = NULL; + + opal_output_verbose(10, ompi_coll_base_framework.framework_output, + "coll:adapt:comm_query (%d/%s): pick me! pick me!", + comm->c_contextid, comm->c_name); + return &(adapt_module->super); +} + +/* + * Init module on the communicator + */ +static int adapt_module_enable(mca_coll_base_module_t * module, struct ompi_communicator_t *comm) +{ + return OMPI_SUCCESS; +} + +/* + * Free ADAPT request + */ +int adapt_request_free(ompi_request_t ** request) +{ + (*request)->req_state = OMPI_REQUEST_INVALID; + OBJ_RELEASE(*request); + *request = MPI_REQUEST_NULL; + return OMPI_SUCCESS; +} diff --git a/ompi/mca/coll/adapt/coll_adapt_reduce.c b/ompi/mca/coll/adapt/coll_adapt_reduce.c new file mode 100644 index 00000000000..f41afe21484 --- /dev/null +++ b/ompi/mca/coll/adapt/coll_adapt_reduce.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "coll_adapt.h" +#include "coll_adapt_algorithms.h" + +/* MPI_Reduce and MPI_Ireduce in the ADAPT module only work for commutative operations */ +int mca_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, + struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, + mca_coll_base_module_t * module) +{ + if (count == 0) { + return MPI_SUCCESS; + } else { + ompi_request_t *request; + int err = + mca_coll_adapt_ireduce(sbuf, rbuf, count, dtype, op, root, comm, &request, module); + ompi_request_wait(&request, MPI_STATUS_IGNORE); + return err; + } +} diff --git a/ompi/mca/coll/base/coll_base_functions.h b/ompi/mca/coll/base/coll_base_functions.h index 11b46ba47eb..fcea107e7c7 100644 --- a/ompi/mca/coll/base/coll_base_functions.h +++ b/ompi/mca/coll/base/coll_base_functions.h @@ -492,6 +492,10 @@ struct mca_coll_base_comm_t { /* in-order binary tree (root of the in-order binary tree is rank 0) */ ompi_coll_tree_t *cached_in_order_bintree; + + /* linear */ + ompi_coll_tree_t *cached_linear; + int cached_linear_root; }; typedef struct mca_coll_base_comm_t mca_coll_base_comm_t; OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_coll_base_comm_t); diff --git a/ompi/request/request.h b/ompi/request/request.h index c0a94a79255..f12882c033c 100644 --- a/ompi/request/request.h +++ b/ompi/request/request.h @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2016 The University of Tennessee and The University + * Copyright (c) 2004-2020 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -436,12 +436,13 @@ static inline void ompi_request_wait_completion(ompi_request_t *req) static inline int ompi_request_complete(ompi_request_t* request, bool with_signal) { int rc = 0; - - if( NULL != request->req_complete_cb) { - rc = request->req_complete_cb( request ); + + if(NULL != request->req_complete_cb) { + ompi_request_complete_fn_t temp = request->req_complete_cb; request->req_complete_cb = NULL; + rc = temp( request ); } - + if (0 == rc) { if( OPAL_LIKELY(with_signal) ) { void *_tmp_ptr = REQUEST_PENDING; @@ -453,13 +454,30 @@ static inline int ompi_request_complete(ompi_request_t* request, bool with_signa if( REQUEST_PENDING != tmp_sync ) wait_sync_update(tmp_sync, 1, request->req_status.MPI_ERROR); } - } else + } else { request->req_complete = REQUEST_COMPLETED; + } } - + return OMPI_SUCCESS; } +static inline int ompi_request_set_callback(ompi_request_t* request, + ompi_request_complete_fn_t cb, + void* cb_data) +{ + request->req_complete_cb_data = cb_data; + request->req_complete_cb = cb; + int rc = 0; + /* If request is completed and the callback is not called, need to call callback */ + if ((NULL != request->req_complete_cb) && (request->req_complete == REQUEST_COMPLETED)) { + ompi_request_complete_fn_t temp = request->req_complete_cb; + request->req_complete_cb = NULL; + rc = temp( request ); + } + return rc; +} + END_C_DECLS #endif From a4be3bb93dcd6f83a7cbdcec020b478fe36f2a48 Mon Sep 17 00:00:00 2001 From: bsergentm Date: Wed, 6 May 2020 18:30:03 +0200 Subject: [PATCH 08/31] Coll/adapt Bull (#15) * piggybacking Bull functionalities * coll/adapt: Fix naming conventions and C11 atomic use This commit fixes some naming convention issues, such as function names which should follow the naming ompi_coll_adapt instead of mca_coll_adapt, reserved for component and module naming (cf. tuned collective component); It also fixes the use of _Atomic construct, which is only valid in C11. OPAL constructs have already been adapted to that use, so use opal_atomic_* types instead. * coll/adapt: Remove unused component field in module This commit removes an unneeded field referencing the component in the module of adapt, as it is already available through the mca_coll_adapt_component global variable. Signed-off-by: Marc Sergent Co-authored-by: Lemarinier, Pierre Co-authored-by: pierrele <31764860+pierrele@users.noreply.github.com> --- ompi/mca/coll/adapt/coll_adapt.h | 25 ++- ompi/mca/coll/adapt/coll_adapt_algorithms.h | 56 ++++--- ompi/mca/coll/adapt/coll_adapt_bcast.c | 4 +- ompi/mca/coll/adapt/coll_adapt_component.c | 82 ++++++---- ompi/mca/coll/adapt/coll_adapt_context.c | 42 +++-- ompi/mca/coll/adapt/coll_adapt_context.h | 40 ++--- ompi/mca/coll/adapt/coll_adapt_ibcast.c | 127 ++++++++------- ompi/mca/coll/adapt/coll_adapt_inbuf.c | 8 +- ompi/mca/coll/adapt/coll_adapt_inbuf.h | 6 +- ompi/mca/coll/adapt/coll_adapt_ireduce.c | 163 +++++++++++--------- ompi/mca/coll/adapt/coll_adapt_item.c | 8 +- ompi/mca/coll/adapt/coll_adapt_item.h | 6 +- ompi/mca/coll/adapt/coll_adapt_module.c | 68 ++++---- ompi/mca/coll/adapt/coll_adapt_reduce.c | 4 +- 14 files changed, 343 insertions(+), 296 deletions(-) diff --git a/ompi/mca/coll/adapt/coll_adapt.h b/ompi/mca/coll/adapt/coll_adapt.h index 0eaca96e5e7..b2a8fcb949c 100644 --- a/ompi/mca/coll/adapt/coll_adapt.h +++ b/ompi/mca/coll/adapt/coll_adapt.h @@ -21,13 +21,15 @@ #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_base_topo.h" -BEGIN_C_DECLS typedef struct mca_coll_adapt_module_t mca_coll_adapt_module_t; +BEGIN_C_DECLS + +typedef struct mca_coll_adapt_module_t mca_coll_adapt_module_t; /* * Structure to hold the adapt coll component. First it holds the * base coll component, and then holds a bunch of * adapt-coll-component-specific stuff (e.g., current MCA param - * values). + * values). */ typedef struct mca_coll_adapt_component_t { /* Base coll component */ @@ -45,7 +47,7 @@ typedef struct mca_coll_adapt_component_t { /* MCA parameter: Minimum number of segment in context free list */ int adapt_context_free_list_min; - /* MCA parameter: Increasment number of segment in context free list */ + /* MCA parameter: Increasement number of segment in context free list */ int adapt_context_free_list_inc; /* Bcast MCA parameter */ @@ -55,7 +57,7 @@ typedef struct mca_coll_adapt_component_t { int adapt_ibcast_max_recv_requests; /* Bcast free list */ opal_free_list_t *adapt_ibcast_context_free_list; - _Atomic int32_t adapt_ibcast_context_free_list_enabled; + opal_atomic_int32_t adapt_ibcast_context_free_list_enabled; /* Reduce MCA parameter */ int adapt_ireduce_algorithm; @@ -68,7 +70,7 @@ typedef struct mca_coll_adapt_component_t { /* Reduce free list */ opal_free_list_t *adapt_ireduce_context_free_list; - _Atomic int32_t adapt_ireduce_context_free_list_enabled; + opal_atomic_int32_t adapt_ireduce_context_free_list_enabled; } mca_coll_adapt_component_t; @@ -78,9 +80,7 @@ struct mca_coll_adapt_module_t { mca_coll_base_module_t super; /* Whether this module has been lazily initialized or not yet */ - bool enabled; - /* Pointer to mca_coll_adapt_component */ - mca_coll_adapt_component_t *adapt_component; + bool adapt_enabled; }; OBJ_CLASS_DECLARATION(mca_coll_adapt_module_t); @@ -88,11 +88,10 @@ OBJ_CLASS_DECLARATION(mca_coll_adapt_module_t); OMPI_MODULE_DECLSPEC extern mca_coll_adapt_component_t mca_coll_adapt_component; /* ADAPT module functions */ -int mca_coll_adapt_init_query(bool enable_progress_threads, bool enable_mpi_threads); - -mca_coll_base_module_t *mca_coll_adapt_comm_query(struct ompi_communicator_t *comm, int *priority); +int ompi_coll_adapt_init_query(bool enable_progress_threads, bool enable_mpi_threads); +mca_coll_base_module_t * ompi_coll_adapt_comm_query(struct ompi_communicator_t *comm, int *priority); /* Free ADAPT quest */ -int adapt_request_free(ompi_request_t ** request); +int ompi_coll_adapt_request_free(ompi_request_t **request); -#endif /* MCA_COLL_ADAPT_EXPORT_H */ +#endif /* MCA_COLL_ADAPT_EXPORT_H */ diff --git a/ompi/mca/coll/adapt/coll_adapt_algorithms.h b/ompi/mca/coll/adapt/coll_adapt_algorithms.h index 8b7b7cebd4f..f0b67b787d8 100644 --- a/ompi/mca/coll/adapt/coll_adapt_algorithms.h +++ b/ompi/mca/coll/adapt/coll_adapt_algorithms.h @@ -14,82 +14,88 @@ #include "ompi/mca/coll/base/coll_base_functions.h" #include -typedef struct mca_coll_adapt_algorithm_index_s { +typedef struct ompi_coll_adapt_algorithm_index_s { int algorithm_index; uintptr_t algorithm_fn_ptr; -} mca_coll_adapt_algorithm_index_t; +} ompi_coll_adapt_algorithm_index_t; /* Bcast */ -int mca_coll_adapt_ibcast_init(void); -int mca_coll_adapt_ibcast_fini(void); -int mca_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_init(void); +int ompi_coll_adapt_ibcast_fini(void); +int ompi_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t * module); -int mca_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module); -int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, ompi_coll_tree_t * tree, size_t seg_size, int ibcast_tag); -int mca_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, +int ompi_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag); -int mca_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, +int ompi_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag); -int mca_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag); -int mca_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, +int ompi_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag); -int mca_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag); -int mca_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag); - +int ompi_coll_adapt_ibcast_tuned(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t *module, int ibcast_tag); /* Reduce */ -int mca_coll_adapt_ireduce_init(void); -int mca_coll_adapt_ireduce_fini(void); -int mca_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, +int ompi_coll_adapt_ireduce_init(void); +int ompi_coll_adapt_ireduce_fini(void); +int ompi_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t * module); -int mca_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, +int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module); -int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, ompi_coll_tree_t * tree, size_t seg_size, int ireduce_tag); -int mca_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_tuned(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t *module, int ireduce_tag); +int ompi_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag); -int mca_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag); -int mca_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag); -int mca_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag); -int mca_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag); -int mca_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag); diff --git a/ompi/mca/coll/adapt/coll_adapt_bcast.c b/ompi/mca/coll/adapt/coll_adapt_bcast.c index 4348f2dc3b5..604898b2e54 100644 --- a/ompi/mca/coll/adapt/coll_adapt_bcast.c +++ b/ompi/mca/coll/adapt/coll_adapt_bcast.c @@ -12,14 +12,14 @@ #include "coll_adapt.h" #include "coll_adapt_algorithms.h" -int mca_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t * module) { if (count == 0) { return MPI_SUCCESS; } else { ompi_request_t *request; - int err = mca_coll_adapt_ibcast(buff, count, datatype, root, comm, &request, module); + int err = ompi_coll_adapt_ibcast(buff, count, datatype, root, comm, &request, module); ompi_request_wait(&request, MPI_STATUS_IGNORE); return err; } diff --git a/ompi/mca/coll/adapt/coll_adapt_component.c b/ompi/mca/coll/adapt/coll_adapt_component.c index 6079c4d92ea..d38cd42b42b 100644 --- a/ompi/mca/coll/adapt/coll_adapt_component.c +++ b/ompi/mca/coll/adapt/coll_adapt_component.c @@ -36,35 +36,32 @@ static int adapt_register(void); */ mca_coll_adapt_component_t mca_coll_adapt_component = { - /* First, fill in the super */ - { - /* First, the mca_component_t struct containing meta - information about the component itself */ - - { - MCA_COLL_BASE_VERSION_2_0_0, - - /* Component name and version */ - "adapt", - OMPI_MAJOR_VERSION, - OMPI_MINOR_VERSION, - OMPI_RELEASE_VERSION, - - /* Component functions */ - adapt_open, /* open */ - adapt_close, - NULL, /* query */ - adapt_register}, - { - /* The component is not checkpoint ready */ - MCA_BASE_METADATA_PARAM_NONE}, - - /* Initialization / querying functions */ - mca_coll_adapt_init_query, - mca_coll_adapt_comm_query, - }, + /* First, the mca_component_t struct containing meta + information about the component itself */ + .collm_version = { + MCA_COLL_BASE_VERSION_2_0_0, + + /* Component name and version */ + .mca_component_name = "adapt", + MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION), + + /* Component functions */ + .mca_open_component = adapt_open, + .mca_close_component = adapt_close, + .mca_register_component_params = adapt_register, + }, + .collm_data = { + /* The component is not checkpoint ready */ + MCA_BASE_METADATA_PARAM_NONE + }, + + /* Initialization / querying functions */ + .collm_init_query = ompi_coll_adapt_init_query, + .collm_comm_query = ompi_coll_adapt_comm_query, + }, /* adapt-component specific information */ @@ -81,6 +78,25 @@ mca_coll_adapt_component_t mca_coll_adapt_component = { /* Open the component */ static int adapt_open(void) { + int param; + mca_coll_adapt_component_t *cs = &mca_coll_adapt_component; + + /* + * Get the global coll verbosity: it will be ours + */ + param = mca_base_var_find("ompi", "coll", "base", "verbose"); + if (param >= 0) { + const int *verbose = NULL; + mca_base_var_get_value(param, &verbose, NULL, NULL); + if (verbose && verbose[0] > 0) { + cs->adapt_output = opal_output_open(NULL); + opal_output_set_verbosity(cs->adapt_output, verbose[0]); + } + } + + opal_output_verbose(1, cs->adapt_output, + "coll:adapt:component_open: done!"); + return OMPI_SUCCESS; } @@ -88,8 +104,8 @@ static int adapt_open(void) /* Shut down the component */ static int adapt_close(void) { - mca_coll_adapt_ibcast_fini(); - mca_coll_adapt_ireduce_fini(); + ompi_coll_adapt_ibcast_fini(); + ompi_coll_adapt_ireduce_fini(); return OMPI_SUCCESS; } @@ -125,7 +141,7 @@ static int adapt_register(void) opal_output_set_verbosity(cs->adapt_output, adapt_verbose); cs->adapt_context_free_list_min = 10; - (void) mca_base_component_var_register(c, "context_free_list_max", + (void) mca_base_component_var_register(c, "context_free_list_min", "Minimum number of segments in context free list", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, @@ -133,7 +149,7 @@ static int adapt_register(void) &cs->adapt_context_free_list_min); cs->adapt_context_free_list_max = 10000; - (void) mca_base_component_var_register(c, "context_free_list_min", + (void) mca_base_component_var_register(c, "context_free_list_max", "Maximum number of segments in context free list", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, @@ -147,8 +163,8 @@ static int adapt_register(void) OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_context_free_list_inc); - mca_coll_adapt_ibcast_init(); - mca_coll_adapt_ireduce_init(); + ompi_coll_adapt_ibcast_init(); + ompi_coll_adapt_ireduce_init(); return adapt_verify_mca_variables(); } diff --git a/ompi/mca/coll/adapt/coll_adapt_context.c b/ompi/mca/coll/adapt/coll_adapt_context.c index 978739df9ab..be03127f23c 100644 --- a/ompi/mca/coll/adapt/coll_adapt_context.c +++ b/ompi/mca/coll/adapt/coll_adapt_context.c @@ -12,60 +12,58 @@ #include "ompi/mca/coll/coll.h" #include "coll_adapt_context.h" -static void mca_coll_adapt_bcast_context_constructor(mca_coll_adapt_bcast_context_t * bcast_context) +static void ompi_coll_adapt_bcast_context_constructor(ompi_coll_adapt_bcast_context_t * bcast_context) { } -static void mca_coll_adapt_bcast_context_destructor(mca_coll_adapt_bcast_context_t * bcast_context) +static void ompi_coll_adapt_bcast_context_destructor(ompi_coll_adapt_bcast_context_t * bcast_context) { - } static void -mca_coll_adapt_constant_bcast_context_constructor(mca_coll_adapt_constant_bcast_context_t * con) +ompi_coll_adapt_constant_bcast_context_constructor(ompi_coll_adapt_constant_bcast_context_t * con) { } -static void mca_coll_adapt_constant_bcast_context_destructor(mca_coll_adapt_constant_bcast_context_t +static void ompi_coll_adapt_constant_bcast_context_destructor(ompi_coll_adapt_constant_bcast_context_t * con) { } -OBJ_CLASS_INSTANCE(mca_coll_adapt_bcast_context_t, opal_free_list_item_t, - mca_coll_adapt_bcast_context_constructor, - mca_coll_adapt_bcast_context_destructor); +OBJ_CLASS_INSTANCE(ompi_coll_adapt_bcast_context_t, opal_free_list_item_t, + ompi_coll_adapt_bcast_context_constructor, + ompi_coll_adapt_bcast_context_destructor); -OBJ_CLASS_INSTANCE(mca_coll_adapt_constant_bcast_context_t, opal_object_t, - mca_coll_adapt_constant_bcast_context_constructor, - mca_coll_adapt_constant_bcast_context_destructor); +OBJ_CLASS_INSTANCE(ompi_coll_adapt_constant_bcast_context_t, opal_object_t, + ompi_coll_adapt_constant_bcast_context_constructor, + ompi_coll_adapt_constant_bcast_context_destructor); -static void mca_coll_adapt_reduce_context_constructor(mca_coll_adapt_reduce_context_t * +static void ompi_coll_adapt_reduce_context_constructor(ompi_coll_adapt_reduce_context_t * reduce_context) { } -static void mca_coll_adapt_reduce_context_destructor(mca_coll_adapt_reduce_context_t * +static void ompi_coll_adapt_reduce_context_destructor(ompi_coll_adapt_reduce_context_t * reduce_context) { - } static void -mca_coll_adapt_constant_reduce_context_constructor(mca_coll_adapt_constant_reduce_context_t * con) +ompi_coll_adapt_constant_reduce_context_constructor(ompi_coll_adapt_constant_reduce_context_t * con) { } static void -mca_coll_adapt_constant_reduce_context_destructor(mca_coll_adapt_constant_reduce_context_t * con) +ompi_coll_adapt_constant_reduce_context_destructor(ompi_coll_adapt_constant_reduce_context_t * con) { } -OBJ_CLASS_INSTANCE(mca_coll_adapt_reduce_context_t, opal_free_list_item_t, - mca_coll_adapt_reduce_context_constructor, - mca_coll_adapt_reduce_context_destructor); +OBJ_CLASS_INSTANCE(ompi_coll_adapt_reduce_context_t, opal_free_list_item_t, + ompi_coll_adapt_reduce_context_constructor, + ompi_coll_adapt_reduce_context_destructor); -OBJ_CLASS_INSTANCE(mca_coll_adapt_constant_reduce_context_t, opal_object_t, - mca_coll_adapt_constant_reduce_context_constructor, - mca_coll_adapt_constant_reduce_context_destructor); +OBJ_CLASS_INSTANCE(ompi_coll_adapt_constant_reduce_context_t, opal_object_t, + ompi_coll_adapt_constant_reduce_context_constructor, + ompi_coll_adapt_constant_reduce_context_destructor); diff --git a/ompi/mca/coll/adapt/coll_adapt_context.h b/ompi/mca/coll/adapt/coll_adapt_context.h index 917e3d48861..eea98fb872e 100644 --- a/ompi/mca/coll/adapt/coll_adapt_context.h +++ b/ompi/mca/coll/adapt/coll_adapt_context.h @@ -19,7 +19,7 @@ #include "coll_adapt_inbuf.h" /* Bcast constant context in bcast context */ -struct mca_coll_adapt_constant_bcast_context_s { +struct ompi_coll_adapt_constant_bcast_context_s { opal_object_t super; int root; size_t count; @@ -42,29 +42,29 @@ struct mca_coll_adapt_constant_bcast_context_s { int ibcast_tag; }; -typedef struct mca_coll_adapt_constant_bcast_context_s mca_coll_adapt_constant_bcast_context_t; +typedef struct ompi_coll_adapt_constant_bcast_context_s ompi_coll_adapt_constant_bcast_context_t; -OBJ_CLASS_DECLARATION(mca_coll_adapt_constant_bcast_context_t); +OBJ_CLASS_DECLARATION(ompi_coll_adapt_constant_bcast_context_t); /* Bcast context of each segment*/ -typedef struct mca_coll_adapt_bcast_context_s mca_coll_adapt_bcast_context_t; +typedef struct ompi_coll_adapt_bcast_context_s ompi_coll_adapt_bcast_context_t; -typedef int (*mca_coll_adapt_bcast_cuda_callback_fn_t) (mca_coll_adapt_bcast_context_t * context); +typedef int (*ompi_coll_adapt_bcast_cuda_callback_fn_t) (ompi_coll_adapt_bcast_context_t * context); -struct mca_coll_adapt_bcast_context_s { +struct ompi_coll_adapt_bcast_context_s { opal_free_list_item_t super; char *buff; int frag_id; int child_id; int peer; - mca_coll_adapt_constant_bcast_context_t *con; + ompi_coll_adapt_constant_bcast_context_t *con; }; -OBJ_CLASS_DECLARATION(mca_coll_adapt_bcast_context_t); +OBJ_CLASS_DECLARATION(ompi_coll_adapt_bcast_context_t); /* Reduce constant context in reduce context */ -struct mca_coll_adapt_constant_reduce_context_s { +struct ompi_coll_adapt_constant_reduce_context_s { opal_object_t super; size_t count; size_t seg_count; @@ -81,7 +81,7 @@ struct mca_coll_adapt_constant_reduce_context_s { /* Number of sent segments */ int32_t num_sent_segs; /* Next seg need to be received for every children */ - _Atomic int32_t *next_recv_segs; + opal_atomic_int32_t *next_recv_segs; /* Mutex to protect recv_list */ opal_mutex_t *mutex_recv_list; /* Mutex to protect num_recv_segs */ @@ -95,12 +95,14 @@ struct mca_coll_adapt_constant_reduce_context_s { ompi_coll_tree_t *tree; /* Accumulate buff */ char **accumbuf; + /* inbuf list address of accumbuf */ + ompi_coll_adapt_inbuf_t ** accumbuf_to_inbuf; opal_free_list_t *inbuf_list; /* A list to store the segments which are received and not yet be sent */ opal_list_t *recv_list; ptrdiff_t lower_bound; /* How many sends are posted but not finished */ - _Atomic int32_t ongoing_send; + opal_atomic_int32_t ongoing_send; char *sbuf; char *rbuf; int root; @@ -109,24 +111,24 @@ struct mca_coll_adapt_constant_reduce_context_s { int ireduce_tag; }; -typedef struct mca_coll_adapt_constant_reduce_context_s mca_coll_adapt_constant_reduce_context_t; +typedef struct ompi_coll_adapt_constant_reduce_context_s ompi_coll_adapt_constant_reduce_context_t; -OBJ_CLASS_DECLARATION(mca_coll_adapt_constant_reduce_context_t); +OBJ_CLASS_DECLARATION(ompi_coll_adapt_constant_reduce_context_t); /* Reduce context of each segment */ -typedef struct mca_coll_adapt_reduce_context_s mca_coll_adapt_reduce_context_t; +typedef struct ompi_coll_adapt_reduce_context_s ompi_coll_adapt_reduce_context_t; -typedef int (*mca_coll_adapt_reduce_cuda_callback_fn_t) (mca_coll_adapt_reduce_context_t * context); +typedef int (*ompi_coll_adapt_reduce_cuda_callback_fn_t) (ompi_coll_adapt_reduce_context_t * context); -struct mca_coll_adapt_reduce_context_s { +struct ompi_coll_adapt_reduce_context_s { opal_free_list_item_t super; char *buff; int frag_id; int child_id; int peer; - mca_coll_adapt_constant_reduce_context_t *con; + ompi_coll_adapt_constant_reduce_context_t *con; /* store the incoming segment */ - mca_coll_adapt_inbuf_t *inbuf; + ompi_coll_adapt_inbuf_t *inbuf; }; -OBJ_CLASS_DECLARATION(mca_coll_adapt_reduce_context_t); +OBJ_CLASS_DECLARATION(ompi_coll_adapt_reduce_context_t); diff --git a/ompi/mca/coll/adapt/coll_adapt_ibcast.c b/ompi/mca/coll/adapt/coll_adapt_ibcast.c index 3582bafcb62..c3f0868102a 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ibcast.c +++ b/ompi/mca/coll/adapt/coll_adapt_ibcast.c @@ -21,33 +21,35 @@ #include "ompi/mca/pml/ob1/pml_ob1.h" -typedef int (*mca_coll_adapt_ibcast_fn_t) (void *buff, +typedef int (*ompi_coll_adapt_ibcast_fn_t) (void *buff, int count, struct ompi_datatype_t * datatype, int root, struct ompi_communicator_t * comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag); - -static mca_coll_adapt_algorithm_index_t mca_coll_adapt_ibcast_algorithm_index[] = { - {1, (uintptr_t) mca_coll_adapt_ibcast_binomial}, - {2, (uintptr_t) mca_coll_adapt_ibcast_in_order_binomial}, - {3, (uintptr_t) mca_coll_adapt_ibcast_binary}, - {4, (uintptr_t) mca_coll_adapt_ibcast_pipeline}, - {5, (uintptr_t) mca_coll_adapt_ibcast_chain}, - {6, (uintptr_t) mca_coll_adapt_ibcast_linear}, + mca_coll_base_module_t * module, + int ibcast_tag); + +static ompi_coll_adapt_algorithm_index_t ompi_coll_adapt_ibcast_algorithm_index[] = { + {0, (uintptr_t) ompi_coll_adapt_ibcast_tuned}, + {1, (uintptr_t) ompi_coll_adapt_ibcast_binomial}, + {2, (uintptr_t) ompi_coll_adapt_ibcast_in_order_binomial}, + {3, (uintptr_t) ompi_coll_adapt_ibcast_binary}, + {4, (uintptr_t) ompi_coll_adapt_ibcast_pipeline}, + {5, (uintptr_t) ompi_coll_adapt_ibcast_chain}, + {6, (uintptr_t) ompi_coll_adapt_ibcast_linear}, }; /* * Set up MCA parameters of MPI_Bcast and MPI_IBcast */ -int mca_coll_adapt_ibcast_init(void) +int ompi_coll_adapt_ibcast_init(void) { mca_base_component_t *c = &mca_coll_adapt_component.super.collm_version; mca_coll_adapt_component.adapt_ibcast_algorithm = 1; mca_base_component_var_register(c, "bcast_algorithm", - "Algorithm of broadcast, 1: binomial, 2: in_order_binomial, 3: binary, 4: pipeline, 5: chain, 6: linear", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + "Algorithm of broadcast, 0: tuned, 1: binomial, 2: in_order_binomial, 3: binary, 4: pipeline, 5: chain, 6: linear", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY, &mca_coll_adapt_component.adapt_ibcast_algorithm); @@ -81,15 +83,15 @@ int mca_coll_adapt_ibcast_init(void) } /* - * Release the free list created in mca_coll_adapt_ibcast_generic + * Release the free list created in ompi_coll_adapt_ibcast_generic */ -int mca_coll_adapt_ibcast_fini(void) +int ompi_coll_adapt_ibcast_fini(void) { if (NULL != mca_coll_adapt_component.adapt_ibcast_context_free_list) { OBJ_RELEASE(mca_coll_adapt_component.adapt_ibcast_context_free_list); mca_coll_adapt_component.adapt_ibcast_context_free_list = NULL; mca_coll_adapt_component.adapt_ibcast_context_free_list_enabled = 0; - OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "ibcast fini\n")); + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "ibcast fini\n")); } return OMPI_SUCCESS; } @@ -97,7 +99,7 @@ int mca_coll_adapt_ibcast_fini(void) /* * Finish a ibcast request */ -static int ibcast_request_fini(mca_coll_adapt_bcast_context_t * context) +static int ibcast_request_fini(ompi_coll_adapt_bcast_context_t * context) { ompi_request_t *temp_req = context->con->request; if (context->con->tree->tree_nextsize != 0) { @@ -121,8 +123,8 @@ static int ibcast_request_fini(mca_coll_adapt_bcast_context_t * context) */ static int send_cb(ompi_request_t * req) { - mca_coll_adapt_bcast_context_t *context = - (mca_coll_adapt_bcast_context_t *) req->req_complete_cb_data; + ompi_coll_adapt_bcast_context_t *context = + (ompi_coll_adapt_bcast_context_t *) req->req_complete_cb_data; int err; @@ -136,10 +138,11 @@ static int send_cb(ompi_request_t * req) /* If the current process has fragments in recv_array can be sent */ if (sent_id < context->con->num_recv_segs) { ompi_request_t *send_req; + ompi_coll_adapt_bcast_context_t *send_context; + opal_free_list_t *free_list; int new_id = context->con->recv_array[sent_id]; - mca_coll_adapt_bcast_context_t *send_context = - (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. - adapt_ibcast_context_free_list); + free_list = mca_coll_adapt_component.adapt_ibcast_context_free_list; + send_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(free_list); send_context->buff = context->buff + (new_id - context->frag_id) * context->con->real_seg_size; send_context->frag_id = new_id; @@ -206,8 +209,8 @@ static int send_cb(ompi_request_t * req) static int recv_cb(ompi_request_t * req) { /* Get necessary info from request */ - mca_coll_adapt_bcast_context_t *context = - (mca_coll_adapt_bcast_context_t *) req->req_complete_cb_data; + ompi_coll_adapt_bcast_context_t *context = + (ompi_coll_adapt_bcast_context_t *) req->req_complete_cb_data; int err, i; OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, @@ -220,14 +223,15 @@ static int recv_cb(ompi_request_t * req) int num_recv_segs_t = ++(context->con->num_recv_segs); context->con->recv_array[num_recv_segs_t - 1] = context->frag_id; + opal_free_list_t *free_list; int new_id = num_recv_segs_t + mca_coll_adapt_component.adapt_ibcast_max_recv_requests - 1; /* Receive new segment */ if (new_id < context->con->num_segs) { ompi_request_t *recv_req; + ompi_coll_adapt_bcast_context_t *recv_context; + free_list = mca_coll_adapt_component.adapt_ibcast_context_free_list; /* Get new context item from free list */ - mca_coll_adapt_bcast_context_t *recv_context = - (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. - adapt_ibcast_context_free_list); + recv_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(free_list); recv_context->buff = context->buff + (new_id - context->frag_id) * context->con->real_seg_size; recv_context->frag_id = new_id; @@ -266,9 +270,9 @@ static int recv_cb(ompi_request_t * req) send_count = context->con->count - context->frag_id * context->con->seg_count; } - mca_coll_adapt_bcast_context_t *send_context = - (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. - adapt_ibcast_context_free_list); + ompi_coll_adapt_bcast_context_t *send_context; + free_list = mca_coll_adapt_component.adapt_ibcast_context_free_list; + send_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(free_list); send_context->buff = context->buff; send_context->frag_id = context->frag_id; send_context->child_id = i; @@ -326,7 +330,7 @@ static int recv_cb(ompi_request_t * req) return 1; } -int mca_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module) { @@ -335,7 +339,7 @@ int mca_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatyp temp_request = OBJ_NEW(ompi_request_t); OMPI_REQUEST_INIT(temp_request, false); temp_request->req_type = 0; - temp_request->req_free = adapt_request_free; + temp_request->req_free = ompi_coll_adapt_request_free; temp_request->req_status.MPI_SOURCE = 0; temp_request->req_status.MPI_TAG = 0; temp_request->req_status.MPI_ERROR = 0; @@ -356,9 +360,9 @@ int mca_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatyp } int ibcast_tag = opal_atomic_add_fetch_32(&(comm->c_ibcast_tag), 1); ibcast_tag = ibcast_tag % 4096; - mca_coll_adapt_ibcast_fn_t bcast_func = - (mca_coll_adapt_ibcast_fn_t) - mca_coll_adapt_ibcast_algorithm_index[mca_coll_adapt_component.adapt_ibcast_algorithm]. + ompi_coll_adapt_ibcast_fn_t bcast_func = + (ompi_coll_adapt_ibcast_fn_t) + ompi_coll_adapt_ibcast_algorithm_index[mca_coll_adapt_component.adapt_ibcast_algorithm]. algorithm_fn_ptr; return bcast_func(buff, count, datatype, root, comm, request, module, ibcast_tag); } @@ -367,72 +371,81 @@ int mca_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatyp /* * Ibcast functions with different algorithms */ -int mca_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, +int ompi_coll_adapt_ibcast_tuned(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t *module, int ibcast_tag) +{ + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "tuned not implemented\n")); + return OMPI_SUCCESS; +} + +int ompi_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_bmtree(comm, root); int err = - mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ibcast_segment_size, ibcast_tag); return err; } -int mca_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, +int ompi_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_in_order_bmtree(comm, root); int err = - mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ibcast_segment_size, ibcast_tag); return err; } -int mca_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_tree(2, comm, root); int err = - mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ibcast_segment_size, ibcast_tag); return err; } -int mca_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, +int ompi_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(1, comm, root); int err = - mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ibcast_segment_size, ibcast_tag); return err; } -int mca_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(4, comm, root); int err = - mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ibcast_segment_size, ibcast_tag); return err; } -int mca_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ibcast_tag) { @@ -446,14 +459,14 @@ int mca_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t * tree = ompi_coll_base_topo_build_tree(MAXTREEFANOUT, comm, root); } int err = - mca_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ibcast_segment_size, ibcast_tag); return err; } -int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root, +int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, ompi_coll_tree_t * tree, size_t seg_size, int ibcast_tag) @@ -494,9 +507,9 @@ int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t if (1 == context_free_list_enabled) { mca_coll_adapt_component.adapt_ibcast_context_free_list = OBJ_NEW(opal_free_list_t); opal_free_list_init(mca_coll_adapt_component.adapt_ibcast_context_free_list, - sizeof(mca_coll_adapt_bcast_context_t), + sizeof(ompi_coll_adapt_bcast_context_t), opal_cache_line_size, - OBJ_CLASS(mca_coll_adapt_bcast_context_t), + OBJ_CLASS(ompi_coll_adapt_bcast_context_t), 0, opal_cache_line_size, mca_coll_adapt_component.adapt_context_free_list_min, mca_coll_adapt_component.adapt_context_free_list_max, @@ -510,7 +523,7 @@ int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t OMPI_REQUEST_INIT(temp_request, false); temp_request->req_state = OMPI_REQUEST_ACTIVE; temp_request->req_type = 0; - temp_request->req_free = adapt_request_free; + temp_request->req_free = ompi_coll_adapt_request_free; temp_request->req_status.MPI_SOURCE = 0; temp_request->req_status.MPI_TAG = 0; temp_request->req_status.MPI_ERROR = 0; @@ -540,7 +553,7 @@ int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t } /* Set constant context for send and recv call back */ - mca_coll_adapt_constant_bcast_context_t *con = OBJ_NEW(mca_coll_adapt_constant_bcast_context_t); + ompi_coll_adapt_constant_bcast_context_t *con = OBJ_NEW(ompi_coll_adapt_constant_bcast_context_t); con->root = root; con->count = count; con->seg_count = seg_count; @@ -582,7 +595,7 @@ int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t recv_array[i] = i; } con->num_recv_segs = num_segs; - /* Set send_array, will send adapt_ibcast_max_send_requests segments */ + /* Set send_array, will send ompi_coll_adapt_ibcast_max_send_requests segments */ for (i = 0; i < tree->tree_nextsize; i++) { send_array[i] = mca_coll_adapt_component.adapt_ibcast_max_send_requests; } @@ -595,8 +608,8 @@ int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t send_count = count - i * seg_count; } for (j = 0; j < tree->tree_nextsize; j++) { - mca_coll_adapt_bcast_context_t *context = - (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. + ompi_coll_adapt_bcast_context_t *context = + (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. adapt_ibcast_context_free_list); context->buff = (char *) buff + i * real_seg_size; context->frag_id = i; @@ -656,8 +669,8 @@ int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t if (i == (num_segs - 1)) { recv_count = count - i * seg_count; } - mca_coll_adapt_bcast_context_t *context = - (mca_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. + ompi_coll_adapt_bcast_context_t *context = + (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component. adapt_ibcast_context_free_list); context->buff = (char *) buff + i * real_seg_size; context->frag_id = i; @@ -691,4 +704,4 @@ int mca_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t "[%d]: End of Ibcast\n", rank)); return MPI_SUCCESS; -} \ No newline at end of file +} diff --git a/ompi/mca/coll/adapt/coll_adapt_inbuf.c b/ompi/mca/coll/adapt/coll_adapt_inbuf.c index 79162966624..a1723ac13d0 100644 --- a/ompi/mca/coll/adapt/coll_adapt_inbuf.c +++ b/ompi/mca/coll/adapt/coll_adapt_inbuf.c @@ -12,13 +12,13 @@ #include "coll_adapt.h" #include "coll_adapt_inbuf.h" -static void mca_coll_adapt_inbuf_constructor(mca_coll_adapt_inbuf_t * inbuf) +static void ompi_coll_adapt_inbuf_constructor(ompi_coll_adapt_inbuf_t * inbuf) { } -static void mca_coll_adapt_inbuf_destructor(mca_coll_adapt_inbuf_t * inbuf) +static void ompi_coll_adapt_inbuf_destructor(ompi_coll_adapt_inbuf_t * inbuf) { } -OBJ_CLASS_INSTANCE(mca_coll_adapt_inbuf_t, opal_free_list_item_t, mca_coll_adapt_inbuf_constructor, - mca_coll_adapt_inbuf_destructor); +OBJ_CLASS_INSTANCE(ompi_coll_adapt_inbuf_t, opal_free_list_item_t, ompi_coll_adapt_inbuf_constructor, + ompi_coll_adapt_inbuf_destructor); diff --git a/ompi/mca/coll/adapt/coll_adapt_inbuf.h b/ompi/mca/coll/adapt/coll_adapt_inbuf.h index 1d450e59ff7..93c3060333b 100644 --- a/ompi/mca/coll/adapt/coll_adapt_inbuf.h +++ b/ompi/mca/coll/adapt/coll_adapt_inbuf.h @@ -14,13 +14,13 @@ #include "opal/class/opal_free_list.h" -struct mca_coll_adapt_inbuf_s { +struct ompi_coll_adapt_inbuf_s { opal_free_list_item_t super; char buff[1]; }; -typedef struct mca_coll_adapt_inbuf_s mca_coll_adapt_inbuf_t; +typedef struct ompi_coll_adapt_inbuf_s ompi_coll_adapt_inbuf_t; -OBJ_CLASS_DECLARATION(mca_coll_adapt_inbuf_t); +OBJ_CLASS_DECLARATION(ompi_coll_adapt_inbuf_t); #endif /* MCA_COLL_ADAPT_INBUF_H */ diff --git a/ompi/mca/coll/adapt/coll_adapt_ireduce.c b/ompi/mca/coll/adapt/coll_adapt_ireduce.c index d99bb87f998..f90c14874f8 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ireduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_ireduce.c @@ -24,7 +24,7 @@ /* MPI_Reduce and MPI_Ireduce in the ADAPT module only work for commutative operations */ -typedef int (*mca_coll_adapt_ireduce_fn_t) (const void *sbuf, +typedef int (*ompi_coll_adapt_ireduce_fn_t) (const void *sbuf, void *rbuf, int count, struct ompi_datatype_t * datatype, @@ -34,19 +34,20 @@ typedef int (*mca_coll_adapt_ireduce_fn_t) (const void *sbuf, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag); -static mca_coll_adapt_algorithm_index_t mca_coll_adapt_ireduce_algorithm_index[] = { - {1, (uintptr_t) mca_coll_adapt_ireduce_binomial}, - {2, (uintptr_t) mca_coll_adapt_ireduce_in_order_binomial}, - {3, (uintptr_t) mca_coll_adapt_ireduce_binary}, - {4, (uintptr_t) mca_coll_adapt_ireduce_pipeline}, - {5, (uintptr_t) mca_coll_adapt_ireduce_chain}, - {6, (uintptr_t) mca_coll_adapt_ireduce_linear}, +static ompi_coll_adapt_algorithm_index_t ompi_coll_adapt_ireduce_algorithm_index[] = { + {0, (uintptr_t)ompi_coll_adapt_ireduce_tuned}, + {1, (uintptr_t) ompi_coll_adapt_ireduce_binomial}, + {2, (uintptr_t) ompi_coll_adapt_ireduce_in_order_binomial}, + {3, (uintptr_t) ompi_coll_adapt_ireduce_binary}, + {4, (uintptr_t) ompi_coll_adapt_ireduce_pipeline}, + {5, (uintptr_t) ompi_coll_adapt_ireduce_chain}, + {6, (uintptr_t) ompi_coll_adapt_ireduce_linear}, }; /* * Set up MCA parameters of MPI_Reduce and MPI_Ireduce */ -int mca_coll_adapt_ireduce_init(void) +int ompi_coll_adapt_ireduce_init(void) { mca_base_component_t *c = &mca_coll_adapt_component.super.collm_version; @@ -111,9 +112,9 @@ int mca_coll_adapt_ireduce_init(void) } /* - * Release the free list created in mca_coll_adapt_ireduce_generic + * Release the free list created in ompi_coll_adapt_ireduce_generic */ -int mca_coll_adapt_ireduce_fini(void) +int ompi_coll_adapt_ireduce_fini(void) { if (NULL != mca_coll_adapt_component.adapt_ireduce_context_free_list) { OBJ_RELEASE(mca_coll_adapt_component.adapt_ireduce_context_free_list); @@ -127,15 +128,15 @@ int mca_coll_adapt_ireduce_fini(void) /* * Functions to access list */ -static mca_coll_adapt_item_t *get_next_ready_item(opal_list_t * list, int num_children) +static ompi_coll_adapt_item_t *get_next_ready_item(opal_list_t * list, int num_children) { - mca_coll_adapt_item_t *item; + ompi_coll_adapt_item_t *item; if (opal_list_is_empty(list)) { return NULL; } - for (item = (mca_coll_adapt_item_t *) opal_list_get_first(list); - item != (mca_coll_adapt_item_t *) opal_list_get_end(list); - item = (mca_coll_adapt_item_t *) ((opal_list_item_t *) item)->opal_list_next) { + for (item = (ompi_coll_adapt_item_t *) opal_list_get_first(list); + item != (ompi_coll_adapt_item_t *) opal_list_get_end(list); + item = (ompi_coll_adapt_item_t *) ((opal_list_item_t *) item)->opal_list_next) { if (item->count == num_children) { opal_list_remove_item(list, (opal_list_item_t *) item); return item; @@ -146,11 +147,11 @@ static mca_coll_adapt_item_t *get_next_ready_item(opal_list_t * list, int num_ch static int add_to_list(opal_list_t * list, int id) { - mca_coll_adapt_item_t *item; + ompi_coll_adapt_item_t *item; int ret = 0; - for (item = (mca_coll_adapt_item_t *) opal_list_get_first(list); - item != (mca_coll_adapt_item_t *) opal_list_get_end(list); - item = (mca_coll_adapt_item_t *) ((opal_list_item_t *) item)->opal_list_next) { + for (item = (ompi_coll_adapt_item_t *) opal_list_get_first(list); + item != (ompi_coll_adapt_item_t *) opal_list_get_end(list); + item = (ompi_coll_adapt_item_t *) ((opal_list_item_t *) item)->opal_list_next) { if (item->id == id) { (item->count)++; ret = 1; @@ -158,7 +159,7 @@ static int add_to_list(opal_list_t * list, int id) } } if (ret == 0) { - item = OBJ_NEW(mca_coll_adapt_item_t); + item = OBJ_NEW(ompi_coll_adapt_item_t); item->id = id; item->count = 1; opal_list_append(list, (opal_list_item_t *) item); @@ -172,15 +173,15 @@ static int add_to_list(opal_list_t * list, int id) /* * Get the inbuf address */ -static mca_coll_adapt_inbuf_t *to_inbuf(char *buf, int distance) +static ompi_coll_adapt_inbuf_t *to_inbuf(char *buf, int distance) { - return (mca_coll_adapt_inbuf_t *) (buf - distance); + return (ompi_coll_adapt_inbuf_t *) (buf - distance); } /* * Finish a ireduce request */ -static int ireduce_request_fini(mca_coll_adapt_reduce_context_t * context) +static int ireduce_request_fini(ompi_coll_adapt_reduce_context_t * context) { /* Return the allocated recourses */ int i; @@ -227,8 +228,8 @@ static int ireduce_request_fini(mca_coll_adapt_reduce_context_t * context) */ static int send_cb(ompi_request_t * req) { - mca_coll_adapt_reduce_context_t *context = - (mca_coll_adapt_reduce_context_t *) req->req_complete_cb_data; + ompi_coll_adapt_reduce_context_t *context = + (ompi_coll_adapt_reduce_context_t *) req->req_complete_cb_data; OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: ireduce_send_cb, peer %d, seg_id %d\n", context->con->rank, context->peer, context->frag_id)); @@ -238,14 +239,14 @@ static int send_cb(ompi_request_t * req) /* Send a new segment */ OPAL_THREAD_LOCK(context->con->mutex_recv_list); - mca_coll_adapt_item_t *item = + ompi_coll_adapt_item_t *item = get_next_ready_item(context->con->recv_list, context->con->tree->tree_nextsize); OPAL_THREAD_UNLOCK(context->con->mutex_recv_list); if (item != NULL) { /* Get new context item from free list */ - mca_coll_adapt_reduce_context_t *send_context = - (mca_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. + ompi_coll_adapt_reduce_context_t *send_context = + (ompi_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. adapt_ireduce_context_free_list); if (context->con->tree->tree_nextsize > 0) { send_context->buff = context->con->accumbuf[item->id]; @@ -316,8 +317,8 @@ static int send_cb(ompi_request_t * req) */ static int recv_cb(ompi_request_t * req) { - mca_coll_adapt_reduce_context_t *context = - (mca_coll_adapt_reduce_context_t *) req->req_complete_cb_data; + ompi_coll_adapt_reduce_context_t *context = + (ompi_coll_adapt_reduce_context_t *) req->req_complete_cb_data; OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: ireduce_recv_cb, peer %d, seg_id %d\n", context->con->rank, context->peer, context->frag_id)); @@ -329,7 +330,7 @@ static int recv_cb(ompi_request_t * req) /* Receive new segment */ if (new_id < context->con->num_segs) { char *temp_recv_buf = NULL; - mca_coll_adapt_inbuf_t *inbuf = NULL; + ompi_coll_adapt_inbuf_t *inbuf = NULL; /* Set inbuf, if it it first child, recv on rbuf, else recv on inbuf */ if (context->child_id == 0 && context->con->sbuf != MPI_IN_PLACE && context->con->root == context->con->rank) { @@ -339,12 +340,12 @@ static int recv_cb(ompi_request_t * req) } else { OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: In recv_cb, alloc inbuf\n", context->con->rank)); - inbuf = (mca_coll_adapt_inbuf_t *) opal_free_list_wait(context->con->inbuf_list); + inbuf = (ompi_coll_adapt_inbuf_t *) opal_free_list_wait(context->con->inbuf_list); temp_recv_buf = inbuf->buff - context->con->lower_bound; } /* Get new context item from free list */ - mca_coll_adapt_reduce_context_t *recv_context = - (mca_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. + ompi_coll_adapt_reduce_context_t *recv_context = + (ompi_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. adapt_ireduce_context_free_list); recv_context->buff = temp_recv_buf; recv_context->frag_id = new_id; @@ -372,7 +373,7 @@ static int recv_cb(ompi_request_t * req) if (MPI_SUCCESS != err) { return err; } - /* Invoke recvive call back */ + /* Invoke receive call back */ ompi_request_set_callback(recv_req, recv_cb, recv_context); } @@ -443,14 +444,14 @@ static int recv_cb(ompi_request_t * req) if (context->con->rank != context->con->tree->tree_root && context->con->ongoing_send < mca_coll_adapt_component.adapt_ireduce_max_send_requests) { OPAL_THREAD_LOCK(context->con->mutex_recv_list); - mca_coll_adapt_item_t *item = + ompi_coll_adapt_item_t *item = get_next_ready_item(context->con->recv_list, context->con->tree->tree_nextsize); OPAL_THREAD_UNLOCK(context->con->mutex_recv_list); if (item != NULL) { - /* Gt new context item from free list */ - mca_coll_adapt_reduce_context_t *send_context = - (mca_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. + /* Get new context item from free list */ + ompi_coll_adapt_reduce_context_t *send_context = + (ompi_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. adapt_ireduce_context_free_list); send_context->buff = context->con->accumbuf[context->frag_id]; send_context->frag_id = item->id; @@ -523,7 +524,7 @@ static int recv_cb(ompi_request_t * req) return 1; } -int mca_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, +int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module) { @@ -543,9 +544,9 @@ int mca_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_ int ireduce_tag = opal_atomic_add_fetch_32(&(comm->c_ireduce_tag), 1); ireduce_tag = (ireduce_tag % 4096) + 4096; fflush(stdout); - mca_coll_adapt_ireduce_fn_t reduce_func = - (mca_coll_adapt_ireduce_fn_t) - mca_coll_adapt_ireduce_algorithm_index[mca_coll_adapt_component. + ompi_coll_adapt_ireduce_fn_t reduce_func = + (ompi_coll_adapt_ireduce_fn_t) + ompi_coll_adapt_ireduce_algorithm_index[mca_coll_adapt_component. adapt_ireduce_algorithm].algorithm_fn_ptr; return reduce_func(sbuf, rbuf, count, dtype, op, root, comm, request, module, ireduce_tag); } @@ -554,20 +555,30 @@ int mca_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_ /* * Ireduce functions with different algorithms */ -int mca_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_tuned(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t *module, int ireduce_tag) +{ + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "tuned not implemented\n")); + return OMPI_SUCCESS; +} + +int ompi_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_bmtree(comm, root); int err = - mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ireduce_segment_size, ireduce_tag); return err; } -int mca_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, @@ -575,53 +586,53 @@ int mca_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int c { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_in_order_bmtree(comm, root); int err = - mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ireduce_segment_size, ireduce_tag); return err; } -int mca_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_tree(2, comm, root); int err = - mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ireduce_segment_size, ireduce_tag); return err; } -int mca_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(1, comm, root); int err = - mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ireduce_segment_size, ireduce_tag); return err; } -int mca_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(4, comm, root); int err = - mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ireduce_segment_size, ireduce_tag); return err; } -int mca_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, int ireduce_tag) @@ -636,14 +647,14 @@ int mca_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, tree = ompi_coll_base_topo_build_tree(MAXTREEFANOUT, comm, root); } int err = - mca_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, + ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, tree, mca_coll_adapt_component.adapt_ireduce_segment_size, ireduce_tag); return err; } -int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, +int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module, ompi_coll_tree_t * tree, @@ -655,7 +666,7 @@ int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, size_t typelng; int seg_count = count, num_segs, rank, recv_count, send_count, i, j, err, min, distance = 0; int32_t seg_index; - _Atomic int *next_recv_segs = NULL; + opal_atomic_int_t *next_recv_segs = NULL; /* Used to store the accumuate result, pointer to every segment */ char **accumbuf = NULL; /* A free list contains all recv data */ @@ -686,9 +697,9 @@ int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, if (1 == context_free_list_enabled) { mca_coll_adapt_component.adapt_ireduce_context_free_list = OBJ_NEW(opal_free_list_t); opal_free_list_init(mca_coll_adapt_component.adapt_ireduce_context_free_list, - sizeof(mca_coll_adapt_reduce_context_t), + sizeof(ompi_coll_adapt_reduce_context_t), opal_cache_line_size, - OBJ_CLASS(mca_coll_adapt_reduce_context_t), + OBJ_CLASS(ompi_coll_adapt_reduce_context_t), 0, opal_cache_line_size, mca_coll_adapt_component.adapt_context_free_list_min, mca_coll_adapt_component.adapt_context_free_list_max, @@ -701,18 +712,18 @@ int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, if (tree->tree_nextsize > 0) { inbuf_list = OBJ_NEW(opal_free_list_t); opal_free_list_init(inbuf_list, - sizeof(mca_coll_adapt_inbuf_t) + real_seg_size, + sizeof(ompi_coll_adapt_inbuf_t) + real_seg_size, opal_cache_line_size, - OBJ_CLASS(mca_coll_adapt_inbuf_t), + OBJ_CLASS(ompi_coll_adapt_inbuf_t), 0, opal_cache_line_size, mca_coll_adapt_component.adapt_inbuf_free_list_min, mca_coll_adapt_component.adapt_inbuf_free_list_max, mca_coll_adapt_component.adapt_inbuf_free_list_inc, NULL, 0, NULL, NULL, NULL); /* Set up next_recv_segs */ - next_recv_segs = (_Atomic int32_t *) malloc(sizeof(int32_t) * tree->tree_nextsize); - mca_coll_adapt_inbuf_t *temp_inbuf = - (mca_coll_adapt_inbuf_t *) opal_free_list_wait(inbuf_list); + next_recv_segs = (opal_atomic_int32_t *) malloc(sizeof(int32_t) * tree->tree_nextsize); + ompi_coll_adapt_inbuf_t *temp_inbuf = + (ompi_coll_adapt_inbuf_t *) opal_free_list_wait(inbuf_list); distance = (char *) temp_inbuf->buff - lower_bound - (char *) temp_inbuf; //address of inbuf->buff to address of inbuf OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: distance %d, inbuf %p, inbuf->buff %p, inbuf->buff-lb %p, to_inbuf %p, inbuf_list %p\n", @@ -732,7 +743,7 @@ int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, OMPI_REQUEST_INIT(temp_request, false); temp_request->req_state = OMPI_REQUEST_ACTIVE; temp_request->req_type = 0; - temp_request->req_free = adapt_request_free; + temp_request->req_free = ompi_coll_adapt_request_free; temp_request->req_status.MPI_SOURCE = 0; temp_request->req_status.MPI_TAG = 0; temp_request->req_status.MPI_ERROR = 0; @@ -752,8 +763,8 @@ int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, recv_list = OBJ_NEW(opal_list_t); /* Set constant context for send and recv call back */ - mca_coll_adapt_constant_reduce_context_t *con = - OBJ_NEW(mca_coll_adapt_constant_reduce_context_t); + ompi_coll_adapt_constant_reduce_context_t *con = + OBJ_NEW(ompi_coll_adapt_constant_reduce_context_t); con->count = count; con->seg_count = seg_count; con->datatype = dtype; @@ -822,21 +833,21 @@ int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, recv_count = count - (ptrdiff_t) seg_count *(ptrdiff_t) seg_index; } char *temp_recv_buf = NULL; - mca_coll_adapt_inbuf_t *inbuf = NULL; + ompi_coll_adapt_inbuf_t *inbuf = NULL; /* Set inbuf, if it it first child, recv on rbuf, else recv on inbuf */ if (i == 0 && sbuf != MPI_IN_PLACE && root == rank) { temp_recv_buf = (char *) rbuf + (ptrdiff_t) j *(ptrdiff_t) segment_increment; } else { - inbuf = (mca_coll_adapt_inbuf_t *) opal_free_list_wait(inbuf_list); + inbuf = (ompi_coll_adapt_inbuf_t *) opal_free_list_wait(inbuf_list); OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: In ireduce, alloc inbuf %p\n", rank, (void *) inbuf)); temp_recv_buf = inbuf->buff - lower_bound; } /* Get context */ - mca_coll_adapt_reduce_context_t *context = - (mca_coll_adapt_reduce_context_t *) + ompi_coll_adapt_reduce_context_t *context = + (ompi_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component. adapt_ireduce_context_free_list); context->buff = temp_recv_buf; @@ -871,10 +882,10 @@ int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, /* Leaf nodes */ else { - mca_coll_adapt_item_t *item; + ompi_coll_adapt_item_t *item; /* Set up recv_list */ for (seg_index = 0; seg_index < num_segs; seg_index++) { - item = OBJ_NEW(mca_coll_adapt_item_t); + item = OBJ_NEW(ompi_coll_adapt_item_t); item->id = seg_index; item->count = tree->tree_nextsize; opal_list_append(recv_list, (opal_list_item_t *) item); @@ -894,8 +905,8 @@ int mca_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, if (item->id == (num_segs - 1)) { send_count = count - (ptrdiff_t) seg_count *(ptrdiff_t) item->id; } - mca_coll_adapt_reduce_context_t *context = - (mca_coll_adapt_reduce_context_t *) + ompi_coll_adapt_reduce_context_t *context = + (ompi_coll_adapt_reduce_context_t *) opal_free_list_wait(mca_coll_adapt_component.adapt_ireduce_context_free_list); context->buff = (char *) sbuf + (ptrdiff_t) item->id * (ptrdiff_t) segment_increment; diff --git a/ompi/mca/coll/adapt/coll_adapt_item.c b/ompi/mca/coll/adapt/coll_adapt_item.c index dabe2ce37b8..73258326a66 100644 --- a/ompi/mca/coll/adapt/coll_adapt_item.c +++ b/ompi/mca/coll/adapt/coll_adapt_item.c @@ -11,13 +11,13 @@ #include "coll_adapt_item.h" -static void mca_coll_adapt_item_constructor(mca_coll_adapt_item_t * item) +static void ompi_coll_adapt_item_constructor(ompi_coll_adapt_item_t * item) { } -static void mca_coll_adapt_item_destructor(mca_coll_adapt_item_t * item) +static void ompi_coll_adapt_item_destructor(ompi_coll_adapt_item_t * item) { } -OBJ_CLASS_INSTANCE(mca_coll_adapt_item_t, opal_list_item_t, mca_coll_adapt_item_constructor, - mca_coll_adapt_item_destructor); +OBJ_CLASS_INSTANCE(ompi_coll_adapt_item_t, opal_list_item_t, ompi_coll_adapt_item_constructor, + ompi_coll_adapt_item_destructor); diff --git a/ompi/mca/coll/adapt/coll_adapt_item.h b/ompi/mca/coll/adapt/coll_adapt_item.h index 2fc6cbdbd03..768f9f29dc0 100644 --- a/ompi/mca/coll/adapt/coll_adapt_item.h +++ b/ompi/mca/coll/adapt/coll_adapt_item.h @@ -12,7 +12,7 @@ #include "opal/class/opal_list.h" #include "coll_adapt_inbuf.h" -struct mca_coll_adapt_item_s { +struct ompi_coll_adapt_item_s { opal_list_item_t super; /* Fragment id */ int id; @@ -20,6 +20,6 @@ struct mca_coll_adapt_item_s { int count; }; -typedef struct mca_coll_adapt_item_s mca_coll_adapt_item_t; +typedef struct ompi_coll_adapt_item_s ompi_coll_adapt_item_t; -OBJ_CLASS_DECLARATION(mca_coll_adapt_item_t); +OBJ_CLASS_DECLARATION(ompi_coll_adapt_item_t); diff --git a/ompi/mca/coll/adapt/coll_adapt_module.c b/ompi/mca/coll/adapt/coll_adapt_module.c index e709313361f..20f27d2ab24 100644 --- a/ompi/mca/coll/adapt/coll_adapt_module.c +++ b/ompi/mca/coll/adapt/coll_adapt_module.c @@ -14,17 +14,17 @@ #include #ifdef HAVE_STRING_H #include -#endif +#endif /* HAVE_STRING_H */ #ifdef HAVE_SCHED_H #include -#endif +#endif /* HAVE_SCHED_H */ #include #ifdef HAVE_SYS_MMAN_H #include -#endif /* HAVE_SYS_MMAN_H */ +#endif /* HAVE_SYS_MMAN_H */ #ifdef HAVE_UNISTD_H #include -#endif /* HAVE_UNISTD_H */ +#endif /* HAVE_UNISTD_H */ #include "mpi.h" #include "opal_stdint.h" @@ -35,7 +35,6 @@ #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/base.h" #include "ompi/mca/coll/base/coll_base_functions.h" -//#include "ompi/mca/rte/rte.h" #include "ompi/proc/proc.h" #include "coll_adapt.h" @@ -47,29 +46,37 @@ /* * Local functions */ -static int adapt_module_enable(mca_coll_base_module_t * module, struct ompi_communicator_t *comm); /* * Module constructor */ -static void mca_coll_adapt_module_construct(mca_coll_adapt_module_t * module) +static void adapt_module_construct(mca_coll_adapt_module_t * module) { - module->enabled = false; - module->adapt_component = &mca_coll_adapt_component; + module->adapt_enabled = false; } /* * Module destructor */ -static void mca_coll_adapt_module_destruct(mca_coll_adapt_module_t * module) +static void adapt_module_destruct(mca_coll_adapt_module_t * module) { - module->enabled = false; + module->adapt_enabled = false; } OBJ_CLASS_INSTANCE(mca_coll_adapt_module_t, - mca_coll_base_module_t, - mca_coll_adapt_module_construct, mca_coll_adapt_module_destruct); + mca_coll_base_module_t, + adapt_module_construct, + adapt_module_destruct); + +/* + * Init module on the communicator + */ +static int adapt_module_enable(mca_coll_base_module_t * module, + struct ompi_communicator_t *comm) +{ + return OMPI_SUCCESS; +} /* * Initial query function that is invoked during MPI_INIT, allowing @@ -77,34 +84,37 @@ OBJ_CLASS_INSTANCE(mca_coll_adapt_module_t, * required level of thread support. This function is invoked exactly * once. */ -int mca_coll_adapt_init_query(bool enable_progress_threads, bool enable_mpi_threads) +int ompi_coll_adapt_init_query(bool enable_progress_threads, bool enable_mpi_threads) { return OMPI_SUCCESS; } - /* * Invoked when there's a new communicator that has been created. * Look at the communicator and decide which set of functions and * priority we want to return. */ -mca_coll_base_module_t *mca_coll_adapt_comm_query(struct ompi_communicator_t * comm, int *priority) +mca_coll_base_module_t *ompi_coll_adapt_comm_query(struct ompi_communicator_t * comm, + int *priority) { mca_coll_adapt_module_t *adapt_module; /* If we're intercomm, or if there's only one process in the communicator */ if (OMPI_COMM_IS_INTER(comm) || 1 == ompi_comm_size(comm)) { opal_output_verbose(10, ompi_coll_base_framework.framework_output, - "coll:adapt:comm_query (%d/%s): intercomm, comm is too small; disqualifying myself", + "coll:adapt:comm_query (%d/%s): intercomm, " + "comm is too small; disqualifying myself", comm->c_contextid, comm->c_name); return NULL; } - /* Get the priority level attached to this module. If priority is less than or equal to 0, then the module is unavailable. */ + /* Get the priority level attached to this module. + If priority is less than or equal to 0, then the module is unavailable. */ *priority = mca_coll_adapt_component.adapt_priority; if (mca_coll_adapt_component.adapt_priority <= 0) { opal_output_verbose(10, ompi_coll_base_framework.framework_output, - "coll:adapt:comm_query (%d/%s): priority too low; disqualifying myself", + "coll:adapt:comm_query (%d/%s): priority too low; " + "disqualifying myself", comm->c_contextid, comm->c_name); return NULL; } @@ -123,17 +133,17 @@ mca_coll_base_module_t *mca_coll_adapt_comm_query(struct ompi_communicator_t * c adapt_module->super.coll_alltoall = NULL; adapt_module->super.coll_alltoallw = NULL; adapt_module->super.coll_barrier = NULL; - adapt_module->super.coll_bcast = mca_coll_adapt_bcast; + adapt_module->super.coll_bcast = ompi_coll_adapt_bcast; adapt_module->super.coll_exscan = NULL; adapt_module->super.coll_gather = NULL; adapt_module->super.coll_gatherv = NULL; - adapt_module->super.coll_reduce = mca_coll_adapt_reduce; + adapt_module->super.coll_reduce = ompi_coll_adapt_reduce; adapt_module->super.coll_reduce_scatter = NULL; adapt_module->super.coll_scan = NULL; adapt_module->super.coll_scatter = NULL; adapt_module->super.coll_scatterv = NULL; - adapt_module->super.coll_ibcast = mca_coll_adapt_ibcast; - adapt_module->super.coll_ireduce = mca_coll_adapt_ireduce; + adapt_module->super.coll_ibcast = ompi_coll_adapt_ibcast; + adapt_module->super.coll_ireduce = ompi_coll_adapt_ireduce; adapt_module->super.coll_iallreduce = NULL; opal_output_verbose(10, ompi_coll_base_framework.framework_output, @@ -143,17 +153,9 @@ mca_coll_base_module_t *mca_coll_adapt_comm_query(struct ompi_communicator_t * c } /* - * Init module on the communicator - */ -static int adapt_module_enable(mca_coll_base_module_t * module, struct ompi_communicator_t *comm) -{ - return OMPI_SUCCESS; -} - -/* - * Free ADAPT request + * Free ADAPT request */ -int adapt_request_free(ompi_request_t ** request) +int ompi_coll_adapt_request_free(ompi_request_t ** request) { (*request)->req_state = OMPI_REQUEST_INVALID; OBJ_RELEASE(*request); diff --git a/ompi/mca/coll/adapt/coll_adapt_reduce.c b/ompi/mca/coll/adapt/coll_adapt_reduce.c index f41afe21484..e45bb3478a9 100644 --- a/ompi/mca/coll/adapt/coll_adapt_reduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_reduce.c @@ -13,7 +13,7 @@ #include "coll_adapt_algorithms.h" /* MPI_Reduce and MPI_Ireduce in the ADAPT module only work for commutative operations */ -int mca_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, +int ompi_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t * module) { @@ -22,7 +22,7 @@ int mca_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_d } else { ompi_request_t *request; int err = - mca_coll_adapt_ireduce(sbuf, rbuf, count, dtype, op, root, comm, &request, module); + ompi_coll_adapt_ireduce(sbuf, rbuf, count, dtype, op, root, comm, &request, module); ompi_request_wait(&request, MPI_STATUS_IGNORE); return err; } From d71264569e92f45d72edb26312206c29e7e2949a Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 7 May 2020 14:42:02 -0400 Subject: [PATCH 09/31] Fix the atomic management of the bcast and reduce freelist API consistent with other collective modules Add comments Other minor cleanups. Signed-off-by: George Bosilca --- ompi/communicator/communicator.h | 14 ++- ompi/mca/coll/adapt/Makefile.am | 6 +- ompi/mca/coll/adapt/coll_adapt.h | 7 +- ompi/mca/coll/adapt/coll_adapt_algorithms.h | 113 +++++++------------- ompi/mca/coll/adapt/coll_adapt_bcast.c | 13 ++- ompi/mca/coll/adapt/coll_adapt_component.c | 43 +++----- ompi/mca/coll/adapt/coll_adapt_context.c | 51 +-------- ompi/mca/coll/adapt/coll_adapt_ibcast.c | 92 +++++++--------- ompi/mca/coll/adapt/coll_adapt_inbuf.c | 12 +-- ompi/mca/coll/adapt/coll_adapt_ireduce.c | 97 ++++++++--------- ompi/mca/coll/adapt/coll_adapt_item.c | 12 +-- ompi/mca/coll/adapt/coll_adapt_item.h | 2 +- ompi/mca/coll/adapt/coll_adapt_reduce.c | 14 +-- ompi/mca/coll/base/coll_base_functions.h | 4 - ompi/mca/coll/tuned/coll_tuned_component.c | 13 +-- ompi/request/request.h | 21 ++-- 16 files changed, 185 insertions(+), 329 deletions(-) diff --git a/ompi/communicator/communicator.h b/ompi/communicator/communicator.h index be7e7acea4e..c642ab4bfb8 100644 --- a/ompi/communicator/communicator.h +++ b/ompi/communicator/communicator.h @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2020 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -187,10 +187,14 @@ struct ompi_communicator_t { /* Collectives module interface and data */ mca_coll_base_comm_coll_t *c_coll; - - /* Non-blocking collective tag */ - _Atomic int32_t c_ibcast_tag; - _Atomic int32_t c_ireduce_tag; + + /* Non-blocking collective tag. These are added here as they should be + * shared between all non-blocking collective modules (to avoid message + * collisions between them in the case where multiple outstanding + * non-blocking collective coexists using multiple backends). + */ + opal_atomic_int32_t c_ibcast_tag; + opal_atomic_int32_t c_ireduce_tag; }; typedef struct ompi_communicator_t ompi_communicator_t; diff --git a/ompi/mca/coll/adapt/Makefile.am b/ompi/mca/coll/adapt/Makefile.am index 157304e3118..59c97a5a76d 100644 --- a/ompi/mca/coll/adapt/Makefile.am +++ b/ompi/mca/coll/adapt/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2014 The University of Tennessee and The University +# Copyright (c) 2014-2020 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. # $COPYRIGHT$ @@ -13,11 +13,11 @@ sources = \ coll_adapt_component.c \ coll_adapt_module.c \ - coll_adapt_bcast.c \ + coll_adapt_bcast.c \ coll_adapt_ibcast.c \ coll_adapt_reduce.c \ coll_adapt_ireduce.c \ - coll_adapt.h \ + coll_adapt.h \ coll_adapt_algorithms.h \ coll_adapt_context.h \ coll_adapt_context.c \ diff --git a/ompi/mca/coll/adapt/coll_adapt.h b/ompi/mca/coll/adapt/coll_adapt.h index b2a8fcb949c..a5c5b4a5f4a 100644 --- a/ompi/mca/coll/adapt/coll_adapt.h +++ b/ompi/mca/coll/adapt/coll_adapt.h @@ -38,8 +38,9 @@ typedef struct mca_coll_adapt_component_t { /* MCA parameter: Priority of this component */ int adapt_priority; - /* MCA parameter: Output verbose level */ + /* MCA parameter: Output stream and verbose level */ int adapt_output; + int adapt_verbose; /* MCA parameter: Maximum number of segment in context free list */ int adapt_context_free_list_max; @@ -57,7 +58,6 @@ typedef struct mca_coll_adapt_component_t { int adapt_ibcast_max_recv_requests; /* Bcast free list */ opal_free_list_t *adapt_ibcast_context_free_list; - opal_atomic_int32_t adapt_ibcast_context_free_list_enabled; /* Reduce MCA parameter */ int adapt_ireduce_algorithm; @@ -70,7 +70,6 @@ typedef struct mca_coll_adapt_component_t { /* Reduce free list */ opal_free_list_t *adapt_ireduce_context_free_list; - opal_atomic_int32_t adapt_ireduce_context_free_list_enabled; } mca_coll_adapt_component_t; @@ -91,7 +90,7 @@ OMPI_MODULE_DECLSPEC extern mca_coll_adapt_component_t mca_coll_adapt_component; int ompi_coll_adapt_init_query(bool enable_progress_threads, bool enable_mpi_threads); mca_coll_base_module_t * ompi_coll_adapt_comm_query(struct ompi_communicator_t *comm, int *priority); -/* Free ADAPT quest */ +/* ADAPT request free */ int ompi_coll_adapt_request_free(ompi_request_t **request); #endif /* MCA_COLL_ADAPT_EXPORT_H */ diff --git a/ompi/mca/coll/adapt/coll_adapt_algorithms.h b/ompi/mca/coll/adapt/coll_adapt_algorithms.h index f0b67b787d8..a25d8afb622 100644 --- a/ompi/mca/coll/adapt/coll_adapt_algorithms.h +++ b/ompi/mca/coll/adapt/coll_adapt_algorithms.h @@ -20,82 +20,45 @@ typedef struct ompi_coll_adapt_algorithm_index_s { } ompi_coll_adapt_algorithm_index_t; /* Bcast */ -int ompi_coll_adapt_ibcast_init(void); +int ompi_coll_adapt_ibcast_register(void); int ompi_coll_adapt_ibcast_fini(void); -int ompi_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, mca_coll_base_module_t * module); -int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module); -int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, ompi_coll_tree_t * tree, - size_t seg_size, int ibcast_tag); -int ompi_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, mca_coll_base_module_t * module, - int ibcast_tag); -int ompi_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag); -int ompi_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag); -int ompi_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, mca_coll_base_module_t * module, - int ibcast_tag); -int ompi_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag); -int ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag); -int ompi_coll_adapt_ibcast_tuned(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t *module, int ibcast_tag); +int ompi_coll_adapt_bcast(BCAST_ARGS); +int ompi_coll_adapt_ibcast(IBCAST_ARGS); +int ompi_coll_adapt_ibcast_generic(IBCAST_ARGS, + ompi_coll_tree_t * tree, size_t seg_size, int ibcast_tag); +int ompi_coll_adapt_ibcast_binomial(IBCAST_ARGS, + int ibcast_tag); +int ompi_coll_adapt_ibcast_in_order_binomial(IBCAST_ARGS, + int ibcast_tag); +int ompi_coll_adapt_ibcast_binary(IBCAST_ARGS, + int ibcast_tag); +int ompi_coll_adapt_ibcast_pipeline(IBCAST_ARGS, + int ibcast_tag); +int ompi_coll_adapt_ibcast_chain(IBCAST_ARGS, + int ibcast_tag); +int ompi_coll_adapt_ibcast_linear(IBCAST_ARGS, + int ibcast_tag); +int ompi_coll_adapt_ibcast_tuned(IBCAST_ARGS, + int ibcast_tag); /* Reduce */ -int ompi_coll_adapt_ireduce_init(void); +int ompi_coll_adapt_ireduce_register(void); int ompi_coll_adapt_ireduce_fini(void); -int ompi_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, - mca_coll_base_module_t * module); -int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, mca_coll_base_module_t * module); -int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, ompi_coll_tree_t * tree, - size_t seg_size, int ireduce_tag); -int ompi_coll_adapt_ireduce_tuned(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t *module, int ireduce_tag); -int ompi_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag); -int ompi_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag); -int ompi_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag); -int ompi_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag); -int ompi_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag); -int ompi_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag); +int ompi_coll_adapt_reduce(REDUCE_ARGS); +int ompi_coll_adapt_ireduce(IREDUCE_ARGS); +int ompi_coll_adapt_ireduce_generic(IREDUCE_ARGS, + ompi_coll_tree_t * tree, size_t seg_size, int ireduce_tag); +int ompi_coll_adapt_ireduce_tuned(IREDUCE_ARGS, + int ireduce_tag); +int ompi_coll_adapt_ireduce_binomial(IREDUCE_ARGS, + int ireduce_tag); +int ompi_coll_adapt_ireduce_in_order_binomial(IREDUCE_ARGS, + int ireduce_tag); +int ompi_coll_adapt_ireduce_binary(IREDUCE_ARGS, + int ireduce_tag); +int ompi_coll_adapt_ireduce_pipeline(IREDUCE_ARGS, + int ireduce_tag); +int ompi_coll_adapt_ireduce_chain(IREDUCE_ARGS, + int ireduce_tag); +int ompi_coll_adapt_ireduce_linear(IREDUCE_ARGS, + int ireduce_tag); diff --git a/ompi/mca/coll/adapt/coll_adapt_bcast.c b/ompi/mca/coll/adapt/coll_adapt_bcast.c index 604898b2e54..2497b6b9905 100644 --- a/ompi/mca/coll/adapt/coll_adapt_bcast.c +++ b/ompi/mca/coll/adapt/coll_adapt_bcast.c @@ -17,10 +17,13 @@ int ompi_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatyp { if (count == 0) { return MPI_SUCCESS; - } else { - ompi_request_t *request; - int err = ompi_coll_adapt_ibcast(buff, count, datatype, root, comm, &request, module); - ompi_request_wait(&request, MPI_STATUS_IGNORE); - return err; } + ompi_request_t *request = NULL; + int err = ompi_coll_adapt_ibcast(buff, count, datatype, root, comm, &request, module); + if( MPI_SUCCESS != err ) { + if( NULL == request ) + return err; + } + ompi_request_wait(&request, MPI_STATUS_IGNORE); + return err; } diff --git a/ompi/mca/coll/adapt/coll_adapt_component.c b/ompi/mca/coll/adapt/coll_adapt_component.c index d38cd42b42b..6ec9964e902 100644 --- a/ompi/mca/coll/adapt/coll_adapt_component.c +++ b/ompi/mca/coll/adapt/coll_adapt_component.c @@ -65,11 +65,10 @@ mca_coll_adapt_component_t mca_coll_adapt_component = { /* adapt-component specific information */ - /* (default) priority */ - 0, + 0, /* (default) priority */ - /* (default) verbose level */ - 0, + 0, /* (default) output stream */ + 0, /* (default) verbose level */ /* default values for non-MCA parameters */ /* Not specifying values here gives us all 0's */ @@ -78,25 +77,13 @@ mca_coll_adapt_component_t mca_coll_adapt_component = { /* Open the component */ static int adapt_open(void) { - int param; mca_coll_adapt_component_t *cs = &mca_coll_adapt_component; - /* - * Get the global coll verbosity: it will be ours - */ - param = mca_base_var_find("ompi", "coll", "base", "verbose"); - if (param >= 0) { - const int *verbose = NULL; - mca_base_var_get_value(param, &verbose, NULL, NULL); - if (verbose && verbose[0] > 0) { - cs->adapt_output = opal_output_open(NULL); - opal_output_set_verbosity(cs->adapt_output, verbose[0]); - } + if (cs->adapt_verbose > 0) { + cs->adapt_output = opal_output_open(NULL); + opal_output_set_verbosity(cs->adapt_output, cs->adapt_verbose); } - opal_output_verbose(1, cs->adapt_output, - "coll:adapt:component_open: done!"); - return OMPI_SUCCESS; } @@ -131,16 +118,14 @@ static int adapt_register(void) OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_priority); - int adapt_verbose = 0; + cs->adapt_verbose = ompi_coll_base_framework.framework_verbose; (void) mca_base_component_var_register(c, "verbose", - "Verbose level", + "Verbose level (default set to the collective framework verbosity)", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, &adapt_verbose); - cs->adapt_output = opal_output_open(NULL); - opal_output_set_verbosity(cs->adapt_output, adapt_verbose); + MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_verbose); - cs->adapt_context_free_list_min = 10; + cs->adapt_context_free_list_min = 64; (void) mca_base_component_var_register(c, "context_free_list_min", "Minimum number of segments in context free list", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, @@ -148,7 +133,7 @@ static int adapt_register(void) MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_context_free_list_min); - cs->adapt_context_free_list_max = 10000; + cs->adapt_context_free_list_max = 1024; (void) mca_base_component_var_register(c, "context_free_list_max", "Maximum number of segments in context free list", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, @@ -156,15 +141,15 @@ static int adapt_register(void) MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_context_free_list_max); - cs->adapt_context_free_list_inc = 10; + cs->adapt_context_free_list_inc = 32; (void) mca_base_component_var_register(c, "context_free_list_inc", "Increasement number of segments in context free list", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_context_free_list_inc); - ompi_coll_adapt_ibcast_init(); - ompi_coll_adapt_ireduce_init(); + ompi_coll_adapt_ibcast_register(); + ompi_coll_adapt_ireduce_register(); return adapt_verify_mca_variables(); } diff --git a/ompi/mca/coll/adapt/coll_adapt_context.c b/ompi/mca/coll/adapt/coll_adapt_context.c index be03127f23c..087eccc9ba9 100644 --- a/ompi/mca/coll/adapt/coll_adapt_context.c +++ b/ompi/mca/coll/adapt/coll_adapt_context.c @@ -12,58 +12,15 @@ #include "ompi/mca/coll/coll.h" #include "coll_adapt_context.h" -static void ompi_coll_adapt_bcast_context_constructor(ompi_coll_adapt_bcast_context_t * bcast_context) -{ -} - -static void ompi_coll_adapt_bcast_context_destructor(ompi_coll_adapt_bcast_context_t * bcast_context) -{ -} - -static void -ompi_coll_adapt_constant_bcast_context_constructor(ompi_coll_adapt_constant_bcast_context_t * con) -{ -} - -static void ompi_coll_adapt_constant_bcast_context_destructor(ompi_coll_adapt_constant_bcast_context_t - * con) -{ -} - OBJ_CLASS_INSTANCE(ompi_coll_adapt_bcast_context_t, opal_free_list_item_t, - ompi_coll_adapt_bcast_context_constructor, - ompi_coll_adapt_bcast_context_destructor); + NULL, NULL); OBJ_CLASS_INSTANCE(ompi_coll_adapt_constant_bcast_context_t, opal_object_t, - ompi_coll_adapt_constant_bcast_context_constructor, - ompi_coll_adapt_constant_bcast_context_destructor); - -static void ompi_coll_adapt_reduce_context_constructor(ompi_coll_adapt_reduce_context_t * - reduce_context) -{ -} - -static void ompi_coll_adapt_reduce_context_destructor(ompi_coll_adapt_reduce_context_t * - reduce_context) -{ -} - -static void -ompi_coll_adapt_constant_reduce_context_constructor(ompi_coll_adapt_constant_reduce_context_t * con) -{ -} - -static void -ompi_coll_adapt_constant_reduce_context_destructor(ompi_coll_adapt_constant_reduce_context_t * con) -{ -} - + NULL, NULL); OBJ_CLASS_INSTANCE(ompi_coll_adapt_reduce_context_t, opal_free_list_item_t, - ompi_coll_adapt_reduce_context_constructor, - ompi_coll_adapt_reduce_context_destructor); + NULL, NULL); OBJ_CLASS_INSTANCE(ompi_coll_adapt_constant_reduce_context_t, opal_object_t, - ompi_coll_adapt_constant_reduce_context_constructor, - ompi_coll_adapt_constant_reduce_context_destructor); + NULL, NULL); diff --git a/ompi/mca/coll/adapt/coll_adapt_ibcast.c b/ompi/mca/coll/adapt/coll_adapt_ibcast.c index c3f0868102a..1b4e8de364f 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ibcast.c +++ b/ompi/mca/coll/adapt/coll_adapt_ibcast.c @@ -43,7 +43,7 @@ static ompi_coll_adapt_algorithm_index_t ompi_coll_adapt_ibcast_algorithm_index[ /* * Set up MCA parameters of MPI_Bcast and MPI_IBcast */ -int ompi_coll_adapt_ibcast_init(void) +int ompi_coll_adapt_ibcast_register(void) { mca_base_component_t *c = &mca_coll_adapt_component.super.collm_version; @@ -78,7 +78,6 @@ int ompi_coll_adapt_ibcast_init(void) &mca_coll_adapt_component.adapt_ibcast_max_recv_requests); mca_coll_adapt_component.adapt_ibcast_context_free_list = NULL; - mca_coll_adapt_component.adapt_ibcast_context_free_list_enabled = 0; return OMPI_SUCCESS; } @@ -90,7 +89,6 @@ int ompi_coll_adapt_ibcast_fini(void) if (NULL != mca_coll_adapt_component.adapt_ibcast_context_free_list) { OBJ_RELEASE(mca_coll_adapt_component.adapt_ibcast_context_free_list); mca_coll_adapt_component.adapt_ibcast_context_free_list = NULL; - mca_coll_adapt_component.adapt_ibcast_context_free_list_enabled = 0; OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "ibcast fini\n")); } return OMPI_SUCCESS; @@ -179,7 +177,6 @@ static int send_cb(ompi_request_t * req) int num_sent = ++(context->con->num_sent_segs); int num_recv_fini_t = context->con->num_recv_fini; int rank = ompi_comm_rank(context->con->comm); - opal_mutex_t *mutex_temp = context->con->mutex; /* Check whether signal the condition */ if ((rank == context->con->root && num_sent == context->con->tree->tree_nextsize * context->con->num_segs) @@ -190,13 +187,13 @@ static int send_cb(ompi_request_t * req) context->con->num_segs)) { OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: Singal in send\n", ompi_comm_rank(context->con->comm))); - OPAL_THREAD_UNLOCK(mutex_temp); + OPAL_THREAD_UNLOCK(context->con->mutex); ibcast_request_fini(context); } else { OBJ_RELEASE(context->con); opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, (opal_free_list_item_t *) context); - OPAL_THREAD_UNLOCK(mutex_temp); + OPAL_THREAD_UNLOCK(context->con->mutex); } req->req_free(&req); /* Call back function return 1, which means successful */ @@ -306,7 +303,6 @@ static int recv_cb(ompi_request_t * req) int num_sent = context->con->num_sent_segs; int num_recv_fini_t = ++(context->con->num_recv_fini); int rank = ompi_comm_rank(context->con->comm); - opal_mutex_t *mutex_temp = context->con->mutex; /* If this process is leaf and has received all the segments */ if ((rank == context->con->root @@ -318,13 +314,13 @@ static int recv_cb(ompi_request_t * req) context->con->num_segs)) { OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: Singal in recv\n", ompi_comm_rank(context->con->comm))); - OPAL_THREAD_UNLOCK(mutex_temp); + OPAL_THREAD_UNLOCK(context->con->mutex); ibcast_request_fini(context); } else { OBJ_RELEASE(context->con); opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, (opal_free_list_item_t *) context); - OPAL_THREAD_UNLOCK(mutex_temp); + OPAL_THREAD_UNLOCK(context->con->mutex); } req->req_free(&req); return 1; @@ -334,9 +330,8 @@ int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *dataty struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module) { - if (count == 0) { - ompi_request_t *temp_request; - temp_request = OBJ_NEW(ompi_request_t); + if (0 == count) { + ompi_request_t *temp_request = OBJ_NEW(ompi_request_t); OMPI_REQUEST_INIT(temp_request, false); temp_request->req_type = 0; temp_request->req_free = ompi_coll_adapt_request_free; @@ -348,24 +343,22 @@ int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *dataty ompi_request_complete(temp_request, 1); *request = temp_request; return MPI_SUCCESS; - } else { - int rank = ompi_comm_rank(comm); - if (rank == root) { - OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, - "ibcast root %d, algorithm %d, coll_adapt_ibcast_segment_size %zu, coll_adapt_ibcast_max_send_requests %d, coll_adapt_ibcast_max_recv_requests %d\n", - root, mca_coll_adapt_component.adapt_ibcast_algorithm, - mca_coll_adapt_component.adapt_ibcast_segment_size, - mca_coll_adapt_component.adapt_ibcast_max_send_requests, - mca_coll_adapt_component.adapt_ibcast_max_recv_requests)); - } - int ibcast_tag = opal_atomic_add_fetch_32(&(comm->c_ibcast_tag), 1); - ibcast_tag = ibcast_tag % 4096; - ompi_coll_adapt_ibcast_fn_t bcast_func = - (ompi_coll_adapt_ibcast_fn_t) - ompi_coll_adapt_ibcast_algorithm_index[mca_coll_adapt_component.adapt_ibcast_algorithm]. - algorithm_fn_ptr; - return bcast_func(buff, count, datatype, root, comm, request, module, ibcast_tag); } + int ibcast_tag = opal_atomic_add_fetch_32(&(comm->c_ibcast_tag), 1); + ibcast_tag = ibcast_tag % 4096; + + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, + "ibcast tag %d root %d, algorithm %d, coll_adapt_ibcast_segment_size %zu, coll_adapt_ibcast_max_send_requests %d, coll_adapt_ibcast_max_recv_requests %d\n", + ibcast_tag, root, mca_coll_adapt_component.adapt_ibcast_algorithm, + mca_coll_adapt_component.adapt_ibcast_segment_size, + mca_coll_adapt_component.adapt_ibcast_max_send_requests, + mca_coll_adapt_component.adapt_ibcast_max_recv_requests)); + + ompi_coll_adapt_ibcast_fn_t bcast_func = + (ompi_coll_adapt_ibcast_fn_t) + ompi_coll_adapt_ibcast_algorithm_index[mca_coll_adapt_component.adapt_ibcast_algorithm]. + algorithm_fn_ptr; + return bcast_func(buff, count, datatype, root, comm, request, module, ibcast_tag); } /* @@ -377,7 +370,7 @@ int ompi_coll_adapt_ibcast_tuned(void *buff, int count, struct ompi_datatype_t * mca_coll_base_module_t *module, int ibcast_tag) { OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "tuned not implemented\n")); - return OMPI_SUCCESS; + return OMPI_ERR_NOT_IMPLEMENTED; } int ompi_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, @@ -471,12 +464,7 @@ int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t mca_coll_base_module_t * module, ompi_coll_tree_t * tree, size_t seg_size, int ibcast_tag) { - /* Tempory variables for iteration */ - int i, j; - /* Rank of this process */ - int rank; - /* Record return value */ - int err; + int i, j, rank, err; /* The min of num_segs and SEND_NUM or RECV_NUM, in case the num_segs is less than SEND_NUM or RECV_NUM */ int min; @@ -498,23 +486,21 @@ int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t /* Record how many isends have been issued for every child */ int *send_array = NULL; - /* Set up free list */ - if (0 == mca_coll_adapt_component.adapt_ibcast_context_free_list_enabled) { - int32_t context_free_list_enabled = - opal_atomic_add_fetch_32(& - (mca_coll_adapt_component. - adapt_ibcast_context_free_list_enabled), 1); - if (1 == context_free_list_enabled) { - mca_coll_adapt_component.adapt_ibcast_context_free_list = OBJ_NEW(opal_free_list_t); - opal_free_list_init(mca_coll_adapt_component.adapt_ibcast_context_free_list, - sizeof(ompi_coll_adapt_bcast_context_t), - opal_cache_line_size, - OBJ_CLASS(ompi_coll_adapt_bcast_context_t), - 0, opal_cache_line_size, - mca_coll_adapt_component.adapt_context_free_list_min, - mca_coll_adapt_component.adapt_context_free_list_max, - mca_coll_adapt_component.adapt_context_free_list_inc, - NULL, 0, NULL, NULL, NULL); + /* Atomically set up free list */ + if (NULL == mca_coll_adapt_component.adapt_ibcast_context_free_list) { + opal_free_list_t* fl = OBJ_NEW(opal_free_list_t); + opal_free_list_init(fl, + sizeof(ompi_coll_adapt_bcast_context_t), + opal_cache_line_size, + OBJ_CLASS(ompi_coll_adapt_bcast_context_t), + 0, opal_cache_line_size, + mca_coll_adapt_component.adapt_context_free_list_min, + mca_coll_adapt_component.adapt_context_free_list_max, + mca_coll_adapt_component.adapt_context_free_list_inc, + NULL, 0, NULL, NULL, NULL); + if( !OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_PTR((opal_atomic_intptr_t *)&mca_coll_adapt_component.adapt_ibcast_context_free_list, + &(intptr_t){0}, fl) ) { + OBJ_RELEASE(fl); } } diff --git a/ompi/mca/coll/adapt/coll_adapt_inbuf.c b/ompi/mca/coll/adapt/coll_adapt_inbuf.c index a1723ac13d0..aed2f309e34 100644 --- a/ompi/mca/coll/adapt/coll_adapt_inbuf.c +++ b/ompi/mca/coll/adapt/coll_adapt_inbuf.c @@ -12,13 +12,5 @@ #include "coll_adapt.h" #include "coll_adapt_inbuf.h" -static void ompi_coll_adapt_inbuf_constructor(ompi_coll_adapt_inbuf_t * inbuf) -{ -} - -static void ompi_coll_adapt_inbuf_destructor(ompi_coll_adapt_inbuf_t * inbuf) -{ -} - -OBJ_CLASS_INSTANCE(ompi_coll_adapt_inbuf_t, opal_free_list_item_t, ompi_coll_adapt_inbuf_constructor, - ompi_coll_adapt_inbuf_destructor); +OBJ_CLASS_INSTANCE(ompi_coll_adapt_inbuf_t, opal_free_list_item_t, + NULL, NULL); diff --git a/ompi/mca/coll/adapt/coll_adapt_ireduce.c b/ompi/mca/coll/adapt/coll_adapt_ireduce.c index f90c14874f8..9fc7cb63ea0 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ireduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_ireduce.c @@ -47,7 +47,7 @@ static ompi_coll_adapt_algorithm_index_t ompi_coll_adapt_ireduce_algorithm_index /* * Set up MCA parameters of MPI_Reduce and MPI_Ireduce */ -int ompi_coll_adapt_ireduce_init(void) +int ompi_coll_adapt_ireduce_register(void) { mca_base_component_t *c = &mca_coll_adapt_component.super.collm_version; @@ -107,7 +107,6 @@ int ompi_coll_adapt_ireduce_init(void) &mca_coll_adapt_component.adapt_inbuf_free_list_inc); mca_coll_adapt_component.adapt_ireduce_context_free_list = NULL; - mca_coll_adapt_component.adapt_ireduce_context_free_list_enabled = 0; return OMPI_SUCCESS; } @@ -119,14 +118,13 @@ int ompi_coll_adapt_ireduce_fini(void) if (NULL != mca_coll_adapt_component.adapt_ireduce_context_free_list) { OBJ_RELEASE(mca_coll_adapt_component.adapt_ireduce_context_free_list); mca_coll_adapt_component.adapt_ireduce_context_free_list = NULL; - mca_coll_adapt_component.adapt_ireduce_context_free_list_enabled = 0; OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "ireduce fini\n")); } return OMPI_SUCCESS; } /* - * Functions to access list + * Functions to access list */ static ompi_coll_adapt_item_t *get_next_ready_item(opal_list_t * list, int num_children) { @@ -148,26 +146,22 @@ static ompi_coll_adapt_item_t *get_next_ready_item(opal_list_t * list, int num_c static int add_to_list(opal_list_t * list, int id) { ompi_coll_adapt_item_t *item; - int ret = 0; for (item = (ompi_coll_adapt_item_t *) opal_list_get_first(list); item != (ompi_coll_adapt_item_t *) opal_list_get_end(list); item = (ompi_coll_adapt_item_t *) ((opal_list_item_t *) item)->opal_list_next) { if (item->id == id) { (item->count)++; - ret = 1; - break; + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "add_to_list_return 1\n")); + return 1; } } - if (ret == 0) { - item = OBJ_NEW(ompi_coll_adapt_item_t); - item->id = id; - item->count = 1; - opal_list_append(list, (opal_list_item_t *) item); - ret = 2; - } - OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "add_to_list_return %d\n", - ret)); - return ret; + /* Add a new object to the list with count set to 1 */ + item = OBJ_NEW(ompi_coll_adapt_item_t); + item->id = id; + item->count = 1; + opal_list_append(list, (opal_list_item_t *) item); + OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "add_to_list_return 1\n")); + return 2; } /* @@ -250,7 +244,6 @@ static int send_cb(ompi_request_t * req) adapt_ireduce_context_free_list); if (context->con->tree->tree_nextsize > 0) { send_context->buff = context->con->accumbuf[item->id]; - } else { send_context->buff = context->buff + (item->id - context->frag_id) * context->con->segment_increment; @@ -530,26 +523,22 @@ int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi { if (count == 0) { return MPI_SUCCESS; - } else { - int rank = ompi_comm_rank(comm); - if (rank == root) { - OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, - "ireduce root %d, algorithm %d, coll_adapt_ireduce_segment_size %zu, coll_adapt_ireduce_max_send_requests %d, coll_adapt_ireduce_max_recv_requests %d\n", - root, mca_coll_adapt_component.adapt_ireduce_algorithm, - mca_coll_adapt_component.adapt_ireduce_segment_size, - mca_coll_adapt_component.adapt_ireduce_max_send_requests, - mca_coll_adapt_component.adapt_ireduce_max_recv_requests)); - } - /* Get ireduce tag */ - int ireduce_tag = opal_atomic_add_fetch_32(&(comm->c_ireduce_tag), 1); - ireduce_tag = (ireduce_tag % 4096) + 4096; - fflush(stdout); - ompi_coll_adapt_ireduce_fn_t reduce_func = - (ompi_coll_adapt_ireduce_fn_t) - ompi_coll_adapt_ireduce_algorithm_index[mca_coll_adapt_component. - adapt_ireduce_algorithm].algorithm_fn_ptr; - return reduce_func(sbuf, rbuf, count, dtype, op, root, comm, request, module, ireduce_tag); } + int ireduce_tag = opal_atomic_add_fetch_32(&(comm->c_ireduce_tag), 1); + ireduce_tag = (ireduce_tag % 4096) + 4096; + + OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, + "ireduce tag %d root %d, algorithm %d, coll_adapt_ireduce_segment_size %zu, coll_adapt_ireduce_max_send_requests %d, coll_adapt_ireduce_max_recv_requests %d\n", + ireduce_tag, root, mca_coll_adapt_component.adapt_ireduce_algorithm, + mca_coll_adapt_component.adapt_ireduce_segment_size, + mca_coll_adapt_component.adapt_ireduce_max_send_requests, + mca_coll_adapt_component.adapt_ireduce_max_recv_requests)); + + ompi_coll_adapt_ireduce_fn_t reduce_func = + (ompi_coll_adapt_ireduce_fn_t) + ompi_coll_adapt_ireduce_algorithm_index[mca_coll_adapt_component. + adapt_ireduce_algorithm].algorithm_fn_ptr; + return reduce_func(sbuf, rbuf, count, dtype, op, root, comm, request, module, ireduce_tag); } /* @@ -562,7 +551,7 @@ int ompi_coll_adapt_ireduce_tuned(const void *sbuf, void *rbuf, int count, mca_coll_base_module_t *module, int ireduce_tag) { OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "tuned not implemented\n")); - return OMPI_SUCCESS; + return OMPI_ERR_NOT_IMPLEMENTED; } int ompi_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, @@ -688,23 +677,21 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, ompi_datatype_get_true_extent(dtype, &true_lower_bound, &true_extent); real_seg_size = true_extent + (ptrdiff_t) (seg_count - 1) * extent; - /* Set up free list */ - if (0 == mca_coll_adapt_component.adapt_ireduce_context_free_list_enabled) { - int32_t context_free_list_enabled = - opal_atomic_add_fetch_32(& - (mca_coll_adapt_component. - adapt_ireduce_context_free_list_enabled), 1); - if (1 == context_free_list_enabled) { - mca_coll_adapt_component.adapt_ireduce_context_free_list = OBJ_NEW(opal_free_list_t); - opal_free_list_init(mca_coll_adapt_component.adapt_ireduce_context_free_list, - sizeof(ompi_coll_adapt_reduce_context_t), - opal_cache_line_size, - OBJ_CLASS(ompi_coll_adapt_reduce_context_t), - 0, opal_cache_line_size, - mca_coll_adapt_component.adapt_context_free_list_min, - mca_coll_adapt_component.adapt_context_free_list_max, - mca_coll_adapt_component.adapt_context_free_list_inc, - NULL, 0, NULL, NULL, NULL); + /* Atomically set up free list */ + if (NULL == mca_coll_adapt_component.adapt_ireduce_context_free_list) { + opal_free_list_t* fl = OBJ_NEW(opal_free_list_t); + opal_free_list_init(fl, + sizeof(ompi_coll_adapt_reduce_context_t), + opal_cache_line_size, + OBJ_CLASS(ompi_coll_adapt_reduce_context_t), + 0, opal_cache_line_size, + mca_coll_adapt_component.adapt_context_free_list_min, + mca_coll_adapt_component.adapt_context_free_list_max, + mca_coll_adapt_component.adapt_context_free_list_inc, + NULL, 0, NULL, NULL, NULL); + if( !OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_PTR((opal_atomic_intptr_t *)&mca_coll_adapt_component.adapt_ireduce_context_free_list, + &(intptr_t){0}, fl) ) { + OBJ_RELEASE(fl); } } diff --git a/ompi/mca/coll/adapt/coll_adapt_item.c b/ompi/mca/coll/adapt/coll_adapt_item.c index 73258326a66..1cb144b309c 100644 --- a/ompi/mca/coll/adapt/coll_adapt_item.c +++ b/ompi/mca/coll/adapt/coll_adapt_item.c @@ -11,13 +11,5 @@ #include "coll_adapt_item.h" -static void ompi_coll_adapt_item_constructor(ompi_coll_adapt_item_t * item) -{ -} - -static void ompi_coll_adapt_item_destructor(ompi_coll_adapt_item_t * item) -{ -} - -OBJ_CLASS_INSTANCE(ompi_coll_adapt_item_t, opal_list_item_t, ompi_coll_adapt_item_constructor, - ompi_coll_adapt_item_destructor); +OBJ_CLASS_INSTANCE(ompi_coll_adapt_item_t, opal_list_item_t, + NULL, NULL); diff --git a/ompi/mca/coll/adapt/coll_adapt_item.h b/ompi/mca/coll/adapt/coll_adapt_item.h index 768f9f29dc0..0eb129704d3 100644 --- a/ompi/mca/coll/adapt/coll_adapt_item.h +++ b/ompi/mca/coll/adapt/coll_adapt_item.h @@ -16,7 +16,7 @@ struct ompi_coll_adapt_item_s { opal_list_item_t super; /* Fragment id */ int id; - /* The number of children which have received the current segment from */ + /* The number of children which have received the current segment */ int count; }; diff --git a/ompi/mca/coll/adapt/coll_adapt_reduce.c b/ompi/mca/coll/adapt/coll_adapt_reduce.c index e45bb3478a9..940673f7b97 100644 --- a/ompi/mca/coll/adapt/coll_adapt_reduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_reduce.c @@ -19,11 +19,13 @@ int ompi_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_ { if (count == 0) { return MPI_SUCCESS; - } else { - ompi_request_t *request; - int err = - ompi_coll_adapt_ireduce(sbuf, rbuf, count, dtype, op, root, comm, &request, module); - ompi_request_wait(&request, MPI_STATUS_IGNORE); - return err; } + ompi_request_t *request = NULL; + int err = ompi_coll_adapt_ireduce(sbuf, rbuf, count, dtype, op, root, comm, &request, module); + if( MPI_SUCCESS != err ) { + if( NULL == request ) + return err; + } + ompi_request_wait(&request, MPI_STATUS_IGNORE); + return err; } diff --git a/ompi/mca/coll/base/coll_base_functions.h b/ompi/mca/coll/base/coll_base_functions.h index fcea107e7c7..11b46ba47eb 100644 --- a/ompi/mca/coll/base/coll_base_functions.h +++ b/ompi/mca/coll/base/coll_base_functions.h @@ -492,10 +492,6 @@ struct mca_coll_base_comm_t { /* in-order binary tree (root of the in-order binary tree is rank 0) */ ompi_coll_tree_t *cached_in_order_bintree; - - /* linear */ - ompi_coll_tree_t *cached_linear; - int cached_linear_root; }; typedef struct mca_coll_base_comm_t mca_coll_base_comm_t; OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_coll_base_comm_t); diff --git a/ompi/mca/coll/tuned/coll_tuned_component.c b/ompi/mca/coll/tuned/coll_tuned_component.c index a17cfacb126..7f6764d5f98 100644 --- a/ompi/mca/coll/tuned/coll_tuned_component.c +++ b/ompi/mca/coll/tuned/coll_tuned_component.c @@ -215,17 +215,8 @@ static int tuned_open(void) int rc; #if OPAL_ENABLE_DEBUG - { - int param; - - param = mca_base_var_find("ompi", "coll", "base", "verbose"); - if (param >= 0) { - const int *verbose = NULL; - mca_base_var_get_value(param, &verbose, NULL, NULL); - if (verbose && verbose[0] > 0) { - ompi_coll_tuned_stream = opal_output_open(NULL); - } - } + if (ompi_coll_base_framework.framework_verbose) { + ompi_coll_tuned_stream = opal_output_open(NULL); } #endif /* OPAL_ENABLE_DEBUG */ diff --git a/ompi/request/request.h b/ompi/request/request.h index f12882c033c..706d98a930c 100644 --- a/ompi/request/request.h +++ b/ompi/request/request.h @@ -436,13 +436,14 @@ static inline void ompi_request_wait_completion(ompi_request_t *req) static inline int ompi_request_complete(ompi_request_t* request, bool with_signal) { int rc = 0; - + if(NULL != request->req_complete_cb) { - ompi_request_complete_fn_t temp = request->req_complete_cb; + /* Set the request cb to NULL to allow resetting in the callback */ + ompi_request_complete_fn_t fct = request->req_complete_cb; request->req_complete_cb = NULL; - rc = temp( request ); + rc = fct( request ); } - + if (0 == rc) { if( OPAL_LIKELY(with_signal) ) { void *_tmp_ptr = REQUEST_PENDING; @@ -454,11 +455,10 @@ static inline int ompi_request_complete(ompi_request_t* request, bool with_signa if( REQUEST_PENDING != tmp_sync ) wait_sync_update(tmp_sync, 1, request->req_status.MPI_ERROR); } - } else { + } else request->req_complete = REQUEST_COMPLETED; - } } - + return OMPI_SUCCESS; } @@ -468,14 +468,13 @@ static inline int ompi_request_set_callback(ompi_request_t* request, { request->req_complete_cb_data = cb_data; request->req_complete_cb = cb; - int rc = 0; /* If request is completed and the callback is not called, need to call callback */ if ((NULL != request->req_complete_cb) && (request->req_complete == REQUEST_COMPLETED)) { - ompi_request_complete_fn_t temp = request->req_complete_cb; + ompi_request_complete_fn_t fct = request->req_complete_cb; request->req_complete_cb = NULL; - rc = temp( request ); + return fct( request ); } - return rc; + return OMPI_SUCCESS; } END_C_DECLS From 8582e10d2be0294892499b9b3f6f486c943b8d7d Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 7 May 2020 18:09:35 -0400 Subject: [PATCH 10/31] Consistent handling of zero counts in the MPI API. Signed-off-by: George Bosilca --- ompi/mpi/c/ibcast.c | 7 +++++++ ompi/mpi/c/ireduce_scatter_block.c | 5 +++++ ompi/mpi/c/reduce_scatter_block.c | 3 +++ 3 files changed, 15 insertions(+) diff --git a/ompi/mpi/c/ibcast.c b/ompi/mpi/c/ibcast.c index 94b821c5b4c..f3f248e949b 100644 --- a/ompi/mpi/c/ibcast.c +++ b/ompi/mpi/c/ibcast.c @@ -96,6 +96,13 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, } } + /* If there's only one node, or if the count is 0, we're done */ + + if ((OMPI_COMM_IS_INTRA(comm) && ompi_comm_size(comm) <= 1) || + 0 == count) { + return MPI_SUCCESS; + } + OPAL_CR_ENTER_LIBRARY(); /* Invoke the coll component to perform the back-end operation */ diff --git a/ompi/mpi/c/ireduce_scatter_block.c b/ompi/mpi/c/ireduce_scatter_block.c index fc85df7f893..3c7cc6ec7ff 100644 --- a/ompi/mpi/c/ireduce_scatter_block.c +++ b/ompi/mpi/c/ireduce_scatter_block.c @@ -97,6 +97,11 @@ int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount, OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); } + if (0 == recvcount) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + OPAL_CR_ENTER_LIBRARY(); /* Invoke the coll component to perform the back-end operation */ diff --git a/ompi/mpi/c/reduce_scatter_block.c b/ompi/mpi/c/reduce_scatter_block.c index 7c12fdd495a..0883ab26773 100644 --- a/ompi/mpi/c/reduce_scatter_block.c +++ b/ompi/mpi/c/reduce_scatter_block.c @@ -94,6 +94,9 @@ int MPI_Reduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount, OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, recvcount); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); } + if (0 == recvcount) { + return MPI_SUCCESS; + } OPAL_CR_ENTER_LIBRARY(); From c2970a36953c8ab0b86ea3610258703affdf07c8 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 7 May 2020 23:59:56 -0400 Subject: [PATCH 11/31] Correctly handle non-blocking collectives tags As it is possible to have multiple outstanding non-blocking collectives provided by different collective modules, we need a consistent mechanism to allow them to select unique tags for each instance of a collective. Signed-off-by: George Bosilca --- ompi/communicator/comm_init.c | 6 +- ompi/communicator/communicator.h | 11 +- ompi/mca/coll/adapt/coll_adapt_algorithms.h | 46 +++---- ompi/mca/coll/adapt/coll_adapt_ibcast.c | 95 ++++++------- ompi/mca/coll/adapt/coll_adapt_ireduce.c | 143 +++++++++----------- ompi/mca/coll/base/coll_base_util.h | 18 +++ ompi/mca/coll/libnbc/coll_libnbc.h | 1 - ompi/mca/coll/libnbc/nbc.c | 23 +--- 8 files changed, 151 insertions(+), 192 deletions(-) diff --git a/ompi/communicator/comm_init.c b/ompi/communicator/comm_init.c index 64dc9faf39c..639372548d0 100644 --- a/ompi/communicator/comm_init.c +++ b/ompi/communicator/comm_init.c @@ -40,6 +40,7 @@ #include "ompi/constants.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/coll/base/base.h" +#include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/topo/base/base.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" @@ -382,9 +383,8 @@ static void ompi_comm_construct(ompi_communicator_t* comm) comm->c_pml_comm = NULL; comm->c_topo = NULL; comm->c_coll = NULL; - comm->c_ibcast_tag = 0; - comm->c_ireduce_tag = 0; - + comm->c_nbc_tag = MCA_COLL_BASE_TAG_NONBLOCKING_BASE; + /* A keyhash will be created if/when an attribute is cached on this communicator */ comm->c_keyhash = NULL; diff --git a/ompi/communicator/communicator.h b/ompi/communicator/communicator.h index c642ab4bfb8..8936b7f1df9 100644 --- a/ompi/communicator/communicator.h +++ b/ompi/communicator/communicator.h @@ -188,13 +188,12 @@ struct ompi_communicator_t { /* Collectives module interface and data */ mca_coll_base_comm_coll_t *c_coll; - /* Non-blocking collective tag. These are added here as they should be - * shared between all non-blocking collective modules (to avoid message - * collisions between them in the case where multiple outstanding - * non-blocking collective coexists using multiple backends). + /* Non-blocking collective tag. These tags might be shared between + * all non-blocking collective modules (to avoid message collision + * between them in the case where multiple outstanding non-blocking + * collective coexists using multiple backends). */ - opal_atomic_int32_t c_ibcast_tag; - opal_atomic_int32_t c_ireduce_tag; + opal_atomic_int32_t c_nbc_tag; }; typedef struct ompi_communicator_t ompi_communicator_t; diff --git a/ompi/mca/coll/adapt/coll_adapt_algorithms.h b/ompi/mca/coll/adapt/coll_adapt_algorithms.h index a25d8afb622..700adabea15 100644 --- a/ompi/mca/coll/adapt/coll_adapt_algorithms.h +++ b/ompi/mca/coll/adapt/coll_adapt_algorithms.h @@ -25,21 +25,14 @@ int ompi_coll_adapt_ibcast_fini(void); int ompi_coll_adapt_bcast(BCAST_ARGS); int ompi_coll_adapt_ibcast(IBCAST_ARGS); int ompi_coll_adapt_ibcast_generic(IBCAST_ARGS, - ompi_coll_tree_t * tree, size_t seg_size, int ibcast_tag); -int ompi_coll_adapt_ibcast_binomial(IBCAST_ARGS, - int ibcast_tag); -int ompi_coll_adapt_ibcast_in_order_binomial(IBCAST_ARGS, - int ibcast_tag); -int ompi_coll_adapt_ibcast_binary(IBCAST_ARGS, - int ibcast_tag); -int ompi_coll_adapt_ibcast_pipeline(IBCAST_ARGS, - int ibcast_tag); -int ompi_coll_adapt_ibcast_chain(IBCAST_ARGS, - int ibcast_tag); -int ompi_coll_adapt_ibcast_linear(IBCAST_ARGS, - int ibcast_tag); -int ompi_coll_adapt_ibcast_tuned(IBCAST_ARGS, - int ibcast_tag); + ompi_coll_tree_t * tree, size_t seg_size); +int ompi_coll_adapt_ibcast_binomial(IBCAST_ARGS); +int ompi_coll_adapt_ibcast_in_order_binomial(IBCAST_ARGS); +int ompi_coll_adapt_ibcast_binary(IBCAST_ARGS); +int ompi_coll_adapt_ibcast_pipeline(IBCAST_ARGS); +int ompi_coll_adapt_ibcast_chain(IBCAST_ARGS); +int ompi_coll_adapt_ibcast_linear(IBCAST_ARGS); +int ompi_coll_adapt_ibcast_tuned(IBCAST_ARGS); /* Reduce */ int ompi_coll_adapt_ireduce_register(void); @@ -47,18 +40,11 @@ int ompi_coll_adapt_ireduce_fini(void); int ompi_coll_adapt_reduce(REDUCE_ARGS); int ompi_coll_adapt_ireduce(IREDUCE_ARGS); int ompi_coll_adapt_ireduce_generic(IREDUCE_ARGS, - ompi_coll_tree_t * tree, size_t seg_size, int ireduce_tag); -int ompi_coll_adapt_ireduce_tuned(IREDUCE_ARGS, - int ireduce_tag); -int ompi_coll_adapt_ireduce_binomial(IREDUCE_ARGS, - int ireduce_tag); -int ompi_coll_adapt_ireduce_in_order_binomial(IREDUCE_ARGS, - int ireduce_tag); -int ompi_coll_adapt_ireduce_binary(IREDUCE_ARGS, - int ireduce_tag); -int ompi_coll_adapt_ireduce_pipeline(IREDUCE_ARGS, - int ireduce_tag); -int ompi_coll_adapt_ireduce_chain(IREDUCE_ARGS, - int ireduce_tag); -int ompi_coll_adapt_ireduce_linear(IREDUCE_ARGS, - int ireduce_tag); + ompi_coll_tree_t * tree, size_t seg_size); +int ompi_coll_adapt_ireduce_tuned(IREDUCE_ARGS); +int ompi_coll_adapt_ireduce_binomial(IREDUCE_ARGS); +int ompi_coll_adapt_ireduce_in_order_binomial(IREDUCE_ARGS); +int ompi_coll_adapt_ireduce_binary(IREDUCE_ARGS); +int ompi_coll_adapt_ireduce_pipeline(IREDUCE_ARGS); +int ompi_coll_adapt_ireduce_chain(IREDUCE_ARGS); +int ompi_coll_adapt_ireduce_linear(IREDUCE_ARGS); diff --git a/ompi/mca/coll/adapt/coll_adapt_ibcast.c b/ompi/mca/coll/adapt/coll_adapt_ibcast.c index 1b4e8de364f..3a8555e7fd2 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ibcast.c +++ b/ompi/mca/coll/adapt/coll_adapt_ibcast.c @@ -14,7 +14,7 @@ #include "coll_adapt.h" #include "coll_adapt_algorithms.h" #include "coll_adapt_context.h" -#include "ompi/mca/coll/base/coll_tags.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/mca/coll/base/coll_base_functions.h" #include "opal/util/bit_ops.h" #include "opal/sys/atomic.h" @@ -27,8 +27,7 @@ typedef int (*ompi_coll_adapt_ibcast_fn_t) (void *buff, int root, struct ompi_communicator_t * comm, ompi_request_t ** request, - mca_coll_base_module_t * module, - int ibcast_tag); + mca_coll_base_module_t * module); static ompi_coll_adapt_algorithm_index_t ompi_coll_adapt_ibcast_algorithm_index[] = { {0, (uintptr_t) ompi_coll_adapt_ibcast_tuned}, @@ -158,11 +157,11 @@ static int send_cb(ompi_request_t * req) "[%d]: Send(start in send cb): segment %d to %d at buff %p send_count %d tag %d\n", ompi_comm_rank(send_context->con->comm), send_context->frag_id, send_context->peer, (void *) send_context->buff, send_count, - (send_context->con->ibcast_tag << 16) + new_id)); + send_context->con->ibcast_tag - new_id)); err = MCA_PML_CALL(isend (send_buff, send_count, send_context->con->datatype, send_context->peer, - (send_context->con->ibcast_tag << 16) + new_id, + send_context->con->ibcast_tag - new_id, MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); if (MPI_SUCCESS != err) { OPAL_THREAD_UNLOCK(context->con->mutex); @@ -245,10 +244,10 @@ static int recv_cb(ompi_request_t * req) "[%d]: Recv(start in recv cb): segment %d from %d at buff %p recv_count %d tag %d\n", ompi_comm_rank(context->con->comm), context->frag_id, context->peer, (void *) recv_buff, recv_count, - (recv_context->con->ibcast_tag << 16) + recv_context->frag_id)); + recv_context->con->ibcast_tag - recv_context->frag_id)); MCA_PML_CALL(irecv (recv_buff, recv_count, recv_context->con->datatype, recv_context->peer, - (recv_context->con->ibcast_tag << 16) + recv_context->frag_id, + recv_context->con->ibcast_tag - recv_context->frag_id, recv_context->con->comm, &recv_req)); /* Invoke recvive call back */ @@ -282,12 +281,12 @@ static int recv_cb(ompi_request_t * req) "[%d]: Send(start in recv cb): segment %d to %d at buff %p send_count %d tag %d\n", ompi_comm_rank(send_context->con->comm), send_context->frag_id, send_context->peer, (void *) send_context->buff, send_count, - (send_context->con->ibcast_tag << 16) + send_context->frag_id)); + send_context->con->ibcast_tag - send_context->frag_id)); err = MCA_PML_CALL(isend (send_buff, send_count, send_context->con->datatype, send_context->peer, - (send_context->con->ibcast_tag << 16) + send_context->frag_id, + send_context->con->ibcast_tag - send_context->frag_id, MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); if (MPI_SUCCESS != err) { OPAL_THREAD_UNLOCK(context->con->mutex); @@ -344,12 +343,10 @@ int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *dataty *request = temp_request; return MPI_SUCCESS; } - int ibcast_tag = opal_atomic_add_fetch_32(&(comm->c_ibcast_tag), 1); - ibcast_tag = ibcast_tag % 4096; OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, - "ibcast tag %d root %d, algorithm %d, coll_adapt_ibcast_segment_size %zu, coll_adapt_ibcast_max_send_requests %d, coll_adapt_ibcast_max_recv_requests %d\n", - ibcast_tag, root, mca_coll_adapt_component.adapt_ibcast_algorithm, + "ibcast root %d, algorithm %d, coll_adapt_ibcast_segment_size %zu, coll_adapt_ibcast_max_send_requests %d, coll_adapt_ibcast_max_recv_requests %d\n", + root, mca_coll_adapt_component.adapt_ibcast_algorithm, mca_coll_adapt_component.adapt_ibcast_segment_size, mca_coll_adapt_component.adapt_ibcast_max_send_requests, mca_coll_adapt_component.adapt_ibcast_max_recv_requests)); @@ -358,89 +355,82 @@ int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *dataty (ompi_coll_adapt_ibcast_fn_t) ompi_coll_adapt_ibcast_algorithm_index[mca_coll_adapt_component.adapt_ibcast_algorithm]. algorithm_fn_ptr; - return bcast_func(buff, count, datatype, root, comm, request, module, ibcast_tag); + return bcast_func(buff, count, datatype, root, comm, request, module); } /* * Ibcast functions with different algorithms */ int ompi_coll_adapt_ibcast_tuned(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t *module, int ibcast_tag) + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t *module) { OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "tuned not implemented\n")); return OMPI_ERR_NOT_IMPLEMENTED; } int ompi_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, mca_coll_base_module_t * module, - int ibcast_tag) + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_bmtree(comm, root); int err = ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size, - ibcast_tag); + mca_coll_adapt_component.adapt_ibcast_segment_size); return err; } int ompi_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag) + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_in_order_bmtree(comm, root); int err = ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size, - ibcast_tag); + mca_coll_adapt_component.adapt_ibcast_segment_size); return err; } int ompi_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag) + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_tree(2, comm, root); int err = ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size, - ibcast_tag); + mca_coll_adapt_component.adapt_ibcast_segment_size); return err; } int ompi_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, mca_coll_base_module_t * module, - int ibcast_tag) + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(1, comm, root); int err = ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size, - ibcast_tag); + mca_coll_adapt_component.adapt_ibcast_segment_size); return err; } int ompi_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag) + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(4, comm, root); int err = ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size, - ibcast_tag); + mca_coll_adapt_component.adapt_ibcast_segment_size); return err; } int ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ibcast_tag) + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { int fanout = ompi_comm_size(comm) - 1; ompi_coll_tree_t *tree; @@ -453,16 +443,15 @@ int ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t } int err = ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size, - ibcast_tag); + mca_coll_adapt_component.adapt_ibcast_segment_size); return err; } int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, ompi_coll_tree_t * tree, - size_t seg_size, int ibcast_tag) + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, ompi_coll_tree_t * tree, + size_t seg_size) { int i, j, rank, err; /* The min of num_segs and SEND_NUM or RECV_NUM, in case the num_segs is less than SEND_NUM or RECV_NUM */ @@ -555,11 +544,11 @@ int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t con->mutex = mutex; con->request = temp_request; con->tree = tree; - con->ibcast_tag = ibcast_tag; + con->ibcast_tag = ompi_coll_base_nbc_reserve_tags(comm, num_segs); OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: Ibcast, root %d, tag %d\n", rank, root, - ibcast_tag)); + con->ibcast_tag)); OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: con->mutex = %p, num_children = %d, num_segs = %d, real_seg_size = %d, seg_count = %d, tree_adreess = %p\n", rank, (void *) con->mutex, tree->tree_nextsize, num_segs, @@ -610,11 +599,11 @@ int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: Send(start in main): segment %d to %d at buff %p send_count %d tag %d\n", rank, context->frag_id, context->peer, - (void *) send_buff, send_count, (ibcast_tag << 16) + i)); + (void *) send_buff, send_count, con->ibcast_tag - i)); err = MCA_PML_CALL(isend (send_buff, send_count, datatype, context->peer, - (ibcast_tag << 16) + i, MCA_PML_BASE_SEND_SYNCHRONOUS, comm, + con->ibcast_tag - i, MCA_PML_BASE_SEND_SYNCHRONOUS, comm, &send_req)); if (MPI_SUCCESS != err) { return err; @@ -668,11 +657,11 @@ int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t "[%d]: Recv(start in main): segment %d from %d at buff %p recv_count %d tag %d\n", ompi_comm_rank(context->con->comm), context->frag_id, context->peer, (void *) recv_buff, recv_count, - (ibcast_tag << 16) + i)); + con->ibcast_tag - i)); err = MCA_PML_CALL(irecv (recv_buff, recv_count, datatype, context->peer, - (ibcast_tag << 16) + i, comm, &recv_req)); + con->ibcast_tag - i, comm, &recv_req)); if (MPI_SUCCESS != err) { return err; } diff --git a/ompi/mca/coll/adapt/coll_adapt_ireduce.c b/ompi/mca/coll/adapt/coll_adapt_ireduce.c index 9fc7cb63ea0..63de926ef53 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ireduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_ireduce.c @@ -17,7 +17,7 @@ #include "coll_adapt_item.h" #include "ompi/constants.h" #include "ompi/mca/coll/coll.h" -#include "ompi/mca/coll/base/coll_tags.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/coll/base/coll_base_functions.h" #include "ompi/mca/coll/base/coll_base_topo.h" @@ -32,7 +32,7 @@ typedef int (*ompi_coll_adapt_ireduce_fn_t) (const void *sbuf, int root, struct ompi_communicator_t * comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag); + mca_coll_base_module_t * module); static ompi_coll_adapt_algorithm_index_t ompi_coll_adapt_ireduce_algorithm_index[] = { {0, (uintptr_t)ompi_coll_adapt_ireduce_tuned}, @@ -263,14 +263,14 @@ static int send_cb(ompi_request_t * req) OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: In send_cb, create isend to seg %d, peer %d, tag %d\n", send_context->con->rank, send_context->frag_id, send_context->peer, - (send_context->con->ireduce_tag << 16) + send_context->frag_id)); + send_context->con->ireduce_tag - send_context->frag_id)); ompi_request_t *send_req; err = MCA_PML_CALL(isend (send_context->buff, send_count, send_context->con->datatype, send_context->peer, - (context->con->ireduce_tag << 16) + send_context->frag_id, + context->con->ireduce_tag - send_context->frag_id, MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); if (MPI_SUCCESS != err) { return err; @@ -355,13 +355,13 @@ static int recv_cb(ompi_request_t * req) "[%d]: In recv_cb, create irecv for seg %d, peer %d, inbuf %p, tag %d\n", context->con->rank, recv_context->frag_id, recv_context->peer, (void *) inbuf, - (recv_context->con->ireduce_tag << 16) + recv_context->frag_id)); + recv_context->con->ireduce_tag - recv_context->frag_id)); ompi_request_t *recv_req; err = MCA_PML_CALL(irecv (temp_recv_buf, recv_count, recv_context->con->datatype, recv_context->peer, - (recv_context->con->ireduce_tag << 16) + recv_context->frag_id, + recv_context->con->ireduce_tag - recv_context->frag_id, recv_context->con->comm, &recv_req)); if (MPI_SUCCESS != err) { return err; @@ -460,14 +460,14 @@ static int recv_cb(ompi_request_t * req) OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: In recv_cb, create isend to seg %d, peer %d, tag %d\n", send_context->con->rank, send_context->frag_id, send_context->peer, - (send_context->con->ireduce_tag << 16) + send_context->frag_id)); + send_context->con->ireduce_tag - send_context->frag_id)); ompi_request_t *send_req; err = MCA_PML_CALL(isend (send_context->buff, send_count, send_context->con->datatype, send_context->peer, - (send_context->con->ireduce_tag << 16) + send_context->frag_id, + send_context->con->ireduce_tag - send_context->frag_id, MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); if (MPI_SUCCESS != err) { return err; @@ -524,12 +524,10 @@ int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi if (count == 0) { return MPI_SUCCESS; } - int ireduce_tag = opal_atomic_add_fetch_32(&(comm->c_ireduce_tag), 1); - ireduce_tag = (ireduce_tag % 4096) + 4096; OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, - "ireduce tag %d root %d, algorithm %d, coll_adapt_ireduce_segment_size %zu, coll_adapt_ireduce_max_send_requests %d, coll_adapt_ireduce_max_recv_requests %d\n", - ireduce_tag, root, mca_coll_adapt_component.adapt_ireduce_algorithm, + "ireduce root %d, algorithm %d, coll_adapt_ireduce_segment_size %zu, coll_adapt_ireduce_max_send_requests %d, coll_adapt_ireduce_max_recv_requests %d\n", + root, mca_coll_adapt_component.adapt_ireduce_algorithm, mca_coll_adapt_component.adapt_ireduce_segment_size, mca_coll_adapt_component.adapt_ireduce_max_send_requests, mca_coll_adapt_component.adapt_ireduce_max_recv_requests)); @@ -538,93 +536,78 @@ int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi (ompi_coll_adapt_ireduce_fn_t) ompi_coll_adapt_ireduce_algorithm_index[mca_coll_adapt_component. adapt_ireduce_algorithm].algorithm_fn_ptr; - return reduce_func(sbuf, rbuf, count, dtype, op, root, comm, request, module, ireduce_tag); + return reduce_func(sbuf, rbuf, count, dtype, op, root, comm, request, module); } /* * Ireduce functions with different algorithms */ int ompi_coll_adapt_ireduce_tuned(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t *module, int ireduce_tag) + struct ompi_datatype_t *dtype, struct ompi_op_t *op, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t *module) { OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "tuned not implemented\n")); return OMPI_ERR_NOT_IMPLEMENTED; } int ompi_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag) + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { - ompi_coll_tree_t *tree = ompi_coll_base_topo_build_bmtree(comm, root); - int err = - ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, - tree, mca_coll_adapt_component.adapt_ireduce_segment_size, - ireduce_tag); - return err; + return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, + request, module, ompi_coll_base_topo_build_bmtree(comm, root), + mca_coll_adapt_component.adapt_ireduce_segment_size); } int ompi_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag) + struct ompi_datatype_t *dtype, struct ompi_op_t *op, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t * module) { - ompi_coll_tree_t *tree = ompi_coll_base_topo_build_in_order_bmtree(comm, root); - int err = - ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, - tree, mca_coll_adapt_component.adapt_ireduce_segment_size, - ireduce_tag); - return err; + return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, + request, module, ompi_coll_base_topo_build_in_order_bmtree(comm, root), + mca_coll_adapt_component.adapt_ireduce_segment_size); } int ompi_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag) + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { - ompi_coll_tree_t *tree = ompi_coll_base_topo_build_tree(2, comm, root); - int err = - ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, - tree, mca_coll_adapt_component.adapt_ireduce_segment_size, - ireduce_tag); - return err; + return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, + request, module, ompi_coll_base_topo_build_tree(2, comm, root), + mca_coll_adapt_component.adapt_ireduce_segment_size); } int ompi_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag) + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { - ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(1, comm, root); - int err = - ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, - tree, mca_coll_adapt_component.adapt_ireduce_segment_size, - ireduce_tag); - return err; + return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, + request, module, ompi_coll_base_topo_build_chain(1, comm, root), + mca_coll_adapt_component.adapt_ireduce_segment_size); } int ompi_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag) + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { - ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(4, comm, root); - int err = - ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, - tree, mca_coll_adapt_component.adapt_ireduce_segment_size, - ireduce_tag); - return err; + return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, + request, module, ompi_coll_base_topo_build_chain(4, comm, root), + mca_coll_adapt_component.adapt_ireduce_segment_size); } int ompi_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, int ireduce_tag) + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { int fanout = ompi_comm_size(comm) - 1; ompi_coll_tree_t *tree; @@ -635,19 +618,17 @@ int ompi_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, } else { tree = ompi_coll_base_topo_build_tree(MAXTREEFANOUT, comm, root); } - int err = - ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, - tree, mca_coll_adapt_component.adapt_ireduce_segment_size, - ireduce_tag); - return err; + return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, + request, module, tree, + mca_coll_adapt_component.adapt_ireduce_segment_size); } int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module, ompi_coll_tree_t * tree, - size_t seg_size, int ireduce_tag) + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module, ompi_coll_tree_t * tree, + size_t seg_size) { ptrdiff_t extent, lower_bound, segment_increment; @@ -777,12 +758,12 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, con->rbuf = (char *) rbuf; con->root = root; con->distance = distance; - con->ireduce_tag = ireduce_tag; + con->ireduce_tag = ompi_coll_base_nbc_reserve_tags(comm, num_segs); con->real_seg_size = real_seg_size; OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: start ireduce root %d tag %d\n", rank, tree->tree_root, - ireduce_tag)); + con->ireduce_tag)); /* If the current process is not leaf node */ if (tree->tree_nextsize > 0) { @@ -849,14 +830,14 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, "[%d]: In ireduce, create irecv for seg %d, peer %d, recv_count %d, inbuf %p tag %d\n", context->con->rank, context->frag_id, context->peer, recv_count, (void *) inbuf, - (ireduce_tag << 16) + seg_index)); + con->ireduce_tag - seg_index)); /* Create a recv request */ ompi_request_t *recv_req; err = MCA_PML_CALL(irecv (temp_recv_buf, recv_count, dtype, tree->tree_next[i], - (ireduce_tag << 16) + seg_index, comm, &recv_req)); + con->ireduce_tag - seg_index, comm, &recv_req)); if (MPI_SUCCESS != err) { return err; } @@ -908,14 +889,14 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: In ireduce, create isend to seg %d, peer %d, send_count %d tag %d\n", context->con->rank, context->frag_id, context->peer, - send_count, (ireduce_tag << 16) + context->frag_id)); + send_count, con->ireduce_tag - context->frag_id)); /* Create send request */ ompi_request_t *send_req; err = MCA_PML_CALL(isend (context->buff, send_count, dtype, tree->tree_prev, - (ireduce_tag << 16) + context->frag_id, + con->ireduce_tag - context->frag_id, MCA_PML_BASE_SEND_SYNCHRONOUS, comm, &send_req)); if (MPI_SUCCESS != err) { return err; diff --git a/ompi/mca/coll/base/coll_base_util.h b/ompi/mca/coll/base/coll_base_util.h index c83e46c2ddb..b54fc70664b 100644 --- a/ompi/mca/coll/base/coll_base_util.h +++ b/ompi/mca/coll/base/coll_base_util.h @@ -27,6 +27,8 @@ #include "ompi/mca/mca.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" +#include "ompi/communicator/communicator.h" +#include "ompi/mca/coll/base/coll_tags.h" #include "ompi/op/op.h" #include "ompi/mca/pml/pml.h" @@ -60,6 +62,22 @@ struct ompi_coll_base_nbc_request_t { OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_coll_base_nbc_request_t); +static inline int32_t +ompi_coll_base_nbc_reserve_tags(ompi_communicator_t* comm, int32_t reserve) +{ + int32_t tag, old_tag; + assert( reserve > 0 ); + reread_tag: /* In case we fail to atomically update the tag */ + tag = old_tag = comm->c_nbc_tag; + if ((tag - reserve) < MCA_COLL_BASE_TAG_NONBLOCKING_END) { + tag = MCA_COLL_BASE_TAG_NONBLOCKING_BASE; + } + if( !OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_32(&comm->c_nbc_tag, &old_tag, tag - reserve) ) { + goto reread_tag; + } + return tag; +} + typedef struct ompi_coll_base_nbc_request_t ompi_coll_base_nbc_request_t; /** diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 682010b6910..3bdeb9419fa 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -94,7 +94,6 @@ struct ompi_coll_libnbc_module_t { mca_coll_base_module_t super; opal_mutex_t mutex; bool comm_registered; - int tag; #ifdef NBC_CACHE_SCHEDULE void *NBC_Dict[NBC_NUM_COLL]; /* this should point to a struct hb_tree, but since this is a diff --git a/ompi/mca/coll/libnbc/nbc.c b/ompi/mca/coll/libnbc/nbc.c index 171f5a37e9c..35e02fe87bf 100644 --- a/ompi/mca/coll/libnbc/nbc.c +++ b/ompi/mca/coll/libnbc/nbc.c @@ -25,7 +25,7 @@ * Additional copyrights may follow */ #include "nbc_internal.h" -#include "ompi/mca/coll/base/coll_tags.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/op/op.h" #include "ompi/mca/pml/pml.h" @@ -595,7 +595,6 @@ void NBC_Return_handle(ompi_coll_libnbc_request_t *request) { } int NBC_Init_comm(MPI_Comm comm, NBC_Comminfo *comminfo) { - comminfo->tag= MCA_COLL_BASE_TAG_NONBLOCKING_BASE; #ifdef NBC_CACHE_SCHEDULE /* initialize the NBC_ALLTOALL SchedCache tree */ @@ -672,7 +671,7 @@ int NBC_Start(NBC_Handle *handle) { int NBC_Schedule_request(NBC_Schedule *schedule, ompi_communicator_t *comm, ompi_coll_libnbc_module_t *module, bool persistent, ompi_request_t **request, void *tmpbuf) { - int ret, tmp_tag; + int ret; bool need_register = false; ompi_coll_libnbc_request_t *handle; @@ -685,13 +684,7 @@ int NBC_Schedule_request(NBC_Schedule *schedule, ompi_communicator_t *comm, /* update the module->tag here because other processes may have operations * and they may update the module->tag */ - OPAL_THREAD_LOCK(&module->mutex); - tmp_tag = module->tag--; - if (tmp_tag == MCA_COLL_BASE_TAG_NONBLOCKING_END) { - tmp_tag = module->tag = MCA_COLL_BASE_TAG_NONBLOCKING_BASE; - NBC_DEBUG(2,"resetting tags ...\n"); - } - OPAL_THREAD_UNLOCK(&module->mutex); + (void)ompi_coll_base_nbc_reserve_tags(comm, 1); OBJ_RELEASE(schedule); free(tmpbuf); @@ -712,20 +705,15 @@ int NBC_Schedule_request(NBC_Schedule *schedule, ompi_communicator_t *comm, /******************** Do the tag and shadow comm administration ... ***************/ - OPAL_THREAD_LOCK(&module->mutex); - tmp_tag = module->tag--; - if (tmp_tag == MCA_COLL_BASE_TAG_NONBLOCKING_END) { - tmp_tag = module->tag = MCA_COLL_BASE_TAG_NONBLOCKING_BASE; - NBC_DEBUG(2,"resetting tags ...\n"); - } + handle->tag = ompi_coll_base_nbc_reserve_tags(comm, 1); + OPAL_THREAD_LOCK(&module->mutex); if (true != module->comm_registered) { module->comm_registered = true; need_register = true; } OPAL_THREAD_UNLOCK(&module->mutex); - handle->tag = tmp_tag; /* register progress */ if (need_register) { @@ -737,7 +725,6 @@ int NBC_Schedule_request(NBC_Schedule *schedule, ompi_communicator_t *comm, } handle->comm=comm; - /*printf("got module: %lu tag: %i\n", module, module->tag);*/ /******************** end of tag and shadow comm administration ... ***************/ handle->comminfo = module; From e59bde912e7da2e0d500ebf45e4521474051e8ff Mon Sep 17 00:00:00 2001 From: Xi Luo Date: Fri, 8 May 2020 01:04:27 -0400 Subject: [PATCH 12/31] Remove the code handling zero count cases in ADAPT. Set request in ibcast.c to empty when the count is 0. Signed-off-by: Xi Luo Signed-off-by: George Bosilca --- ompi/mca/coll/adapt/coll_adapt_bcast.c | 3 --- ompi/mca/coll/adapt/coll_adapt_ibcast.c | 15 --------------- ompi/mca/coll/adapt/coll_adapt_ireduce.c | 4 ---- ompi/mca/coll/adapt/coll_adapt_reduce.c | 3 --- ompi/mpi/c/ibcast.c | 1 + 5 files changed, 1 insertion(+), 25 deletions(-) diff --git a/ompi/mca/coll/adapt/coll_adapt_bcast.c b/ompi/mca/coll/adapt/coll_adapt_bcast.c index 2497b6b9905..9cfebd97859 100644 --- a/ompi/mca/coll/adapt/coll_adapt_bcast.c +++ b/ompi/mca/coll/adapt/coll_adapt_bcast.c @@ -15,9 +15,6 @@ int ompi_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t * module) { - if (count == 0) { - return MPI_SUCCESS; - } ompi_request_t *request = NULL; int err = ompi_coll_adapt_ibcast(buff, count, datatype, root, comm, &request, module); if( MPI_SUCCESS != err ) { diff --git a/ompi/mca/coll/adapt/coll_adapt_ibcast.c b/ompi/mca/coll/adapt/coll_adapt_ibcast.c index 3a8555e7fd2..624e3955332 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ibcast.c +++ b/ompi/mca/coll/adapt/coll_adapt_ibcast.c @@ -329,21 +329,6 @@ int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *dataty struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module) { - if (0 == count) { - ompi_request_t *temp_request = OBJ_NEW(ompi_request_t); - OMPI_REQUEST_INIT(temp_request, false); - temp_request->req_type = 0; - temp_request->req_free = ompi_coll_adapt_request_free; - temp_request->req_status.MPI_SOURCE = 0; - temp_request->req_status.MPI_TAG = 0; - temp_request->req_status.MPI_ERROR = 0; - temp_request->req_status._cancelled = 0; - temp_request->req_status._ucount = 0; - ompi_request_complete(temp_request, 1); - *request = temp_request; - return MPI_SUCCESS; - } - OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "ibcast root %d, algorithm %d, coll_adapt_ibcast_segment_size %zu, coll_adapt_ibcast_max_send_requests %d, coll_adapt_ibcast_max_recv_requests %d\n", root, mca_coll_adapt_component.adapt_ibcast_algorithm, diff --git a/ompi/mca/coll/adapt/coll_adapt_ireduce.c b/ompi/mca/coll/adapt/coll_adapt_ireduce.c index 63de926ef53..b105181be7a 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ireduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_ireduce.c @@ -521,10 +521,6 @@ int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t * module) { - if (count == 0) { - return MPI_SUCCESS; - } - OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "ireduce root %d, algorithm %d, coll_adapt_ireduce_segment_size %zu, coll_adapt_ireduce_max_send_requests %d, coll_adapt_ireduce_max_recv_requests %d\n", root, mca_coll_adapt_component.adapt_ireduce_algorithm, diff --git a/ompi/mca/coll/adapt/coll_adapt_reduce.c b/ompi/mca/coll/adapt/coll_adapt_reduce.c index 940673f7b97..e3559ec20df 100644 --- a/ompi/mca/coll/adapt/coll_adapt_reduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_reduce.c @@ -17,9 +17,6 @@ int ompi_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_ struct ompi_op_t *op, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t * module) { - if (count == 0) { - return MPI_SUCCESS; - } ompi_request_t *request = NULL; int err = ompi_coll_adapt_ireduce(sbuf, rbuf, count, dtype, op, root, comm, &request, module); if( MPI_SUCCESS != err ) { diff --git a/ompi/mpi/c/ibcast.c b/ompi/mpi/c/ibcast.c index f3f248e949b..f25f9d3ea95 100644 --- a/ompi/mpi/c/ibcast.c +++ b/ompi/mpi/c/ibcast.c @@ -100,6 +100,7 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, if ((OMPI_COMM_IS_INTRA(comm) && ompi_comm_size(comm) <= 1) || 0 == count) { + *request = &ompi_request_empty; return MPI_SUCCESS; } From ee592f367277783c5761abb5b08645f55749b9f6 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 23 Jul 2020 16:39:36 -0400 Subject: [PATCH 13/31] Address the comments on the PR. Signed-off-by: George Bosilca --- ompi/mca/coll/adapt/coll_adapt_algorithms.h | 27 +-- ompi/mca/coll/adapt/coll_adapt_context.h | 2 +- ompi/mca/coll/adapt/coll_adapt_ibcast.c | 197 ++++++++++---------- ompi/mca/coll/adapt/coll_adapt_inbuf.h | 2 +- ompi/mca/coll/adapt/coll_adapt_ireduce.c | 123 ++++++------ 5 files changed, 183 insertions(+), 168 deletions(-) diff --git a/ompi/mca/coll/adapt/coll_adapt_algorithms.h b/ompi/mca/coll/adapt/coll_adapt_algorithms.h index 700adabea15..cfece373043 100644 --- a/ompi/mca/coll/adapt/coll_adapt_algorithms.h +++ b/ompi/mca/coll/adapt/coll_adapt_algorithms.h @@ -14,9 +14,15 @@ #include "ompi/mca/coll/base/coll_base_functions.h" #include +typedef int (*ompi_mca_coll_adapt_ibcast_function_t)(IBCAST_ARGS); +typedef int (*ompi_mca_coll_adapt_ireduce_function_t)(IREDUCE_ARGS); + typedef struct ompi_coll_adapt_algorithm_index_s { int algorithm_index; - uintptr_t algorithm_fn_ptr; + union { + ompi_mca_coll_adapt_ibcast_function_t ibcast_fn_ptr; + ompi_mca_coll_adapt_ireduce_function_t ireduce_fn_ptr; + }; } ompi_coll_adapt_algorithm_index_t; /* Bcast */ @@ -24,27 +30,10 @@ int ompi_coll_adapt_ibcast_register(void); int ompi_coll_adapt_ibcast_fini(void); int ompi_coll_adapt_bcast(BCAST_ARGS); int ompi_coll_adapt_ibcast(IBCAST_ARGS); -int ompi_coll_adapt_ibcast_generic(IBCAST_ARGS, - ompi_coll_tree_t * tree, size_t seg_size); -int ompi_coll_adapt_ibcast_binomial(IBCAST_ARGS); -int ompi_coll_adapt_ibcast_in_order_binomial(IBCAST_ARGS); -int ompi_coll_adapt_ibcast_binary(IBCAST_ARGS); -int ompi_coll_adapt_ibcast_pipeline(IBCAST_ARGS); -int ompi_coll_adapt_ibcast_chain(IBCAST_ARGS); -int ompi_coll_adapt_ibcast_linear(IBCAST_ARGS); -int ompi_coll_adapt_ibcast_tuned(IBCAST_ARGS); /* Reduce */ int ompi_coll_adapt_ireduce_register(void); int ompi_coll_adapt_ireduce_fini(void); int ompi_coll_adapt_reduce(REDUCE_ARGS); int ompi_coll_adapt_ireduce(IREDUCE_ARGS); -int ompi_coll_adapt_ireduce_generic(IREDUCE_ARGS, - ompi_coll_tree_t * tree, size_t seg_size); -int ompi_coll_adapt_ireduce_tuned(IREDUCE_ARGS); -int ompi_coll_adapt_ireduce_binomial(IREDUCE_ARGS); -int ompi_coll_adapt_ireduce_in_order_binomial(IREDUCE_ARGS); -int ompi_coll_adapt_ireduce_binary(IREDUCE_ARGS); -int ompi_coll_adapt_ireduce_pipeline(IREDUCE_ARGS); -int ompi_coll_adapt_ireduce_chain(IREDUCE_ARGS); -int ompi_coll_adapt_ireduce_linear(IREDUCE_ARGS); + diff --git a/ompi/mca/coll/adapt/coll_adapt_context.h b/ompi/mca/coll/adapt/coll_adapt_context.h index eea98fb872e..e96ad5266ff 100644 --- a/ompi/mca/coll/adapt/coll_adapt_context.h +++ b/ompi/mca/coll/adapt/coll_adapt_context.h @@ -89,7 +89,7 @@ struct ompi_coll_adapt_constant_reduce_context_s { /* Mutex to protect num_sent */ opal_mutex_t *mutex_num_sent; /* Mutex to protect each segment when do the reduce op */ - opal_mutex_t **mutex_op_list; + opal_mutex_t *mutex_op_list; /* Reduce operation */ ompi_op_t *op; ompi_coll_tree_t *tree; diff --git a/ompi/mca/coll/adapt/coll_adapt_ibcast.c b/ompi/mca/coll/adapt/coll_adapt_ibcast.c index 624e3955332..35a4dda8ee5 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ibcast.c +++ b/ompi/mca/coll/adapt/coll_adapt_ibcast.c @@ -20,6 +20,15 @@ #include "opal/sys/atomic.h" #include "ompi/mca/pml/ob1/pml_ob1.h" +static int ompi_coll_adapt_ibcast_generic(IBCAST_ARGS, + ompi_coll_tree_t * tree, size_t seg_size); +static int ompi_coll_adapt_ibcast_binomial(IBCAST_ARGS); +static int ompi_coll_adapt_ibcast_in_order_binomial(IBCAST_ARGS); +static int ompi_coll_adapt_ibcast_binary(IBCAST_ARGS); +static int ompi_coll_adapt_ibcast_pipeline(IBCAST_ARGS); +static int ompi_coll_adapt_ibcast_chain(IBCAST_ARGS); +static int ompi_coll_adapt_ibcast_linear(IBCAST_ARGS); +static int ompi_coll_adapt_ibcast_tuned(IBCAST_ARGS); typedef int (*ompi_coll_adapt_ibcast_fn_t) (void *buff, int count, @@ -30,13 +39,13 @@ typedef int (*ompi_coll_adapt_ibcast_fn_t) (void *buff, mca_coll_base_module_t * module); static ompi_coll_adapt_algorithm_index_t ompi_coll_adapt_ibcast_algorithm_index[] = { - {0, (uintptr_t) ompi_coll_adapt_ibcast_tuned}, - {1, (uintptr_t) ompi_coll_adapt_ibcast_binomial}, - {2, (uintptr_t) ompi_coll_adapt_ibcast_in_order_binomial}, - {3, (uintptr_t) ompi_coll_adapt_ibcast_binary}, - {4, (uintptr_t) ompi_coll_adapt_ibcast_pipeline}, - {5, (uintptr_t) ompi_coll_adapt_ibcast_chain}, - {6, (uintptr_t) ompi_coll_adapt_ibcast_linear}, + {0, {ompi_coll_adapt_ibcast_tuned}}, + {1, {ompi_coll_adapt_ibcast_binomial}}, + {2, {ompi_coll_adapt_ibcast_in_order_binomial}}, + {3, {ompi_coll_adapt_ibcast_binary}}, + {4, {ompi_coll_adapt_ibcast_pipeline}}, + {5, {ompi_coll_adapt_ibcast_chain}}, + {6, {ompi_coll_adapt_ibcast_linear}}, }; /* @@ -51,6 +60,10 @@ int ompi_coll_adapt_ibcast_register(void) "Algorithm of broadcast, 0: tuned, 1: binomial, 2: in_order_binomial, 3: binary, 4: pipeline, 5: chain, 6: linear", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY, &mca_coll_adapt_component.adapt_ibcast_algorithm); + if( (mca_coll_adapt_component.adapt_ibcast_algorithm < 0) || + (mca_coll_adapt_component.adapt_ibcast_algorithm > (int32_t)(sizeof(ompi_coll_adapt_ibcast_algorithm_index) / sizeof(ompi_coll_adapt_algorithm_index_t))) ) { + mca_coll_adapt_component.adapt_ibcast_algorithm = 1; + } mca_coll_adapt_component.adapt_ibcast_segment_size = 0; mca_base_component_var_register(c, "bcast_segment_size", @@ -107,7 +120,6 @@ static int ibcast_request_fini(ompi_coll_adapt_bcast_context_t * context) } OBJ_RELEASE(context->con->mutex); OBJ_RELEASE(context->con); - OBJ_RELEASE(context->con); opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, (opal_free_list_item_t *) context); ompi_request_complete(temp_req, 1); @@ -122,7 +134,6 @@ static int send_cb(ompi_request_t * req) { ompi_coll_adapt_bcast_context_t *context = (ompi_coll_adapt_bcast_context_t *) req->req_complete_cb_data; - int err; OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, @@ -134,19 +145,17 @@ static int send_cb(ompi_request_t * req) int sent_id = context->con->send_array[context->child_id]; /* If the current process has fragments in recv_array can be sent */ if (sent_id < context->con->num_recv_segs) { - ompi_request_t *send_req; ompi_coll_adapt_bcast_context_t *send_context; - opal_free_list_t *free_list; int new_id = context->con->recv_array[sent_id]; - free_list = mca_coll_adapt_component.adapt_ibcast_context_free_list; - send_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(free_list); + ompi_request_t *send_req; + + send_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component.adapt_ibcast_context_free_list); send_context->buff = context->buff + (new_id - context->frag_id) * context->con->real_seg_size; send_context->frag_id = new_id; send_context->child_id = context->child_id; send_context->peer = context->peer; send_context->con = context->con; - OBJ_RETAIN(context->con); int send_count = send_context->con->seg_count; if (new_id == (send_context->con->num_segs - 1)) { send_count = send_context->con->count - new_id * send_context->con->seg_count; @@ -158,38 +167,42 @@ static int send_cb(ompi_request_t * req) ompi_comm_rank(send_context->con->comm), send_context->frag_id, send_context->peer, (void *) send_context->buff, send_count, send_context->con->ibcast_tag - new_id)); - err = - MCA_PML_CALL(isend - (send_buff, send_count, send_context->con->datatype, send_context->peer, - send_context->con->ibcast_tag - new_id, - MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); + err = MCA_PML_CALL(isend + (send_buff, send_count, send_context->con->datatype, send_context->peer, + send_context->con->ibcast_tag - new_id, + MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); if (MPI_SUCCESS != err) { + opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, + (opal_free_list_item_t *)send_context); OPAL_THREAD_UNLOCK(context->con->mutex); + OBJ_RELEASE(context->con); return err; } - /* Invoke send call back */ + /* Set send callback */ OPAL_THREAD_UNLOCK(context->con->mutex); ompi_request_set_callback(send_req, send_cb, send_context); OPAL_THREAD_LOCK(context->con->mutex); + } else { + /* No future send here, we can release the ref */ + OBJ_RELEASE(context->con); } int num_sent = ++(context->con->num_sent_segs); - int num_recv_fini_t = context->con->num_recv_fini; + int num_recv_fini = context->con->num_recv_fini; int rank = ompi_comm_rank(context->con->comm); /* Check whether signal the condition */ if ((rank == context->con->root && num_sent == context->con->tree->tree_nextsize * context->con->num_segs) || (context->con->tree->tree_nextsize > 0 && rank != context->con->root && num_sent == context->con->tree->tree_nextsize * context->con->num_segs - && num_recv_fini_t == context->con->num_segs) || (context->con->tree->tree_nextsize == 0 - && num_recv_fini_t == - context->con->num_segs)) { + && num_recv_fini == context->con->num_segs) + || (context->con->tree->tree_nextsize == 0 + && num_recv_fini == context->con->num_segs)) { OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: Singal in send\n", ompi_comm_rank(context->con->comm))); OPAL_THREAD_UNLOCK(context->con->mutex); ibcast_request_fini(context); } else { - OBJ_RELEASE(context->con); opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, (opal_free_list_item_t *) context); OPAL_THREAD_UNLOCK(context->con->mutex); @@ -216,18 +229,16 @@ static int recv_cb(ompi_request_t * req) /* Store the frag_id to seg array */ OPAL_THREAD_LOCK(context->con->mutex); - int num_recv_segs_t = ++(context->con->num_recv_segs); - context->con->recv_array[num_recv_segs_t - 1] = context->frag_id; + int num_recv_segs = ++(context->con->num_recv_segs); + context->con->recv_array[num_recv_segs - 1] = context->frag_id; - opal_free_list_t *free_list; - int new_id = num_recv_segs_t + mca_coll_adapt_component.adapt_ibcast_max_recv_requests - 1; + int new_id = num_recv_segs + mca_coll_adapt_component.adapt_ibcast_max_recv_requests - 1; /* Receive new segment */ if (new_id < context->con->num_segs) { ompi_request_t *recv_req; ompi_coll_adapt_bcast_context_t *recv_context; - free_list = mca_coll_adapt_component.adapt_ibcast_context_free_list; /* Get new context item from free list */ - recv_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(free_list); + recv_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component.adapt_ibcast_context_free_list); recv_context->buff = context->buff + (new_id - context->frag_id) * context->con->real_seg_size; recv_context->frag_id = new_id; @@ -250,16 +261,16 @@ static int recv_cb(ompi_request_t * req) recv_context->con->ibcast_tag - recv_context->frag_id, recv_context->con->comm, &recv_req)); - /* Invoke recvive call back */ + /* Set the receive callback */ OPAL_THREAD_UNLOCK(context->con->mutex); ompi_request_set_callback(recv_req, recv_cb, recv_context); OPAL_THREAD_LOCK(context->con->mutex); } - /* Send segment to its children */ + /* Propagate segment to all children */ for (i = 0; i < context->con->tree->tree_nextsize; i++) { /* If the current process can send the segment now, which means the only segment need to be sent is the just arrived one */ - if (num_recv_segs_t - 1 == context->con->send_array[i]) { + if (num_recv_segs - 1 == context->con->send_array[i]) { ompi_request_t *send_req; int send_count = context->con->seg_count; if (context->frag_id == (context->con->num_segs - 1)) { @@ -267,8 +278,7 @@ static int recv_cb(ompi_request_t * req) } ompi_coll_adapt_bcast_context_t *send_context; - free_list = mca_coll_adapt_component.adapt_ibcast_context_free_list; - send_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(free_list); + send_context = (ompi_coll_adapt_bcast_context_t *) opal_free_list_wait(mca_coll_adapt_component.adapt_ibcast_context_free_list); send_context->buff = context->buff; send_context->frag_id = context->frag_id; send_context->child_id = i; @@ -289,18 +299,23 @@ static int recv_cb(ompi_request_t * req) send_context->con->ibcast_tag - send_context->frag_id, MCA_PML_BASE_SEND_SYNCHRONOUS, send_context->con->comm, &send_req)); if (MPI_SUCCESS != err) { + opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, + (opal_free_list_item_t *)send_context); OPAL_THREAD_UNLOCK(context->con->mutex); + OBJ_RELEASE(context->con); return err; } - /* Invoke send call back */ + /* Set send callback */ OPAL_THREAD_UNLOCK(context->con->mutex); ompi_request_set_callback(send_req, send_cb, send_context); OPAL_THREAD_LOCK(context->con->mutex); } } + OBJ_RELEASE(context->con); + int num_sent = context->con->num_sent_segs; - int num_recv_fini_t = ++(context->con->num_recv_fini); + int num_recv_fini = ++(context->con->num_recv_fini); int rank = ompi_comm_rank(context->con->comm); /* If this process is leaf and has received all the segments */ @@ -308,15 +323,14 @@ static int recv_cb(ompi_request_t * req) && num_sent == context->con->tree->tree_nextsize * context->con->num_segs) || (context->con->tree->tree_nextsize > 0 && rank != context->con->root && num_sent == context->con->tree->tree_nextsize * context->con->num_segs - && num_recv_fini_t == context->con->num_segs) || (context->con->tree->tree_nextsize == 0 - && num_recv_fini_t == - context->con->num_segs)) { + && num_recv_fini == context->con->num_segs) + || (context->con->tree->tree_nextsize == 0 + && num_recv_fini == context->con->num_segs)) { OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: Singal in recv\n", ompi_comm_rank(context->con->comm))); OPAL_THREAD_UNLOCK(context->con->mutex); ibcast_request_fini(context); } else { - OBJ_RELEASE(context->con); opal_free_list_return(mca_coll_adapt_component.adapt_ibcast_context_free_list, (opal_free_list_item_t *) context); OPAL_THREAD_UNLOCK(context->con->mutex); @@ -337,85 +351,80 @@ int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *dataty mca_coll_adapt_component.adapt_ibcast_max_recv_requests)); ompi_coll_adapt_ibcast_fn_t bcast_func = - (ompi_coll_adapt_ibcast_fn_t) - ompi_coll_adapt_ibcast_algorithm_index[mca_coll_adapt_component.adapt_ibcast_algorithm]. - algorithm_fn_ptr; + ompi_coll_adapt_ibcast_algorithm_index[mca_coll_adapt_component.adapt_ibcast_algorithm].ibcast_fn_ptr; return bcast_func(buff, count, datatype, root, comm, request, module); } /* * Ibcast functions with different algorithms */ -int ompi_coll_adapt_ibcast_tuned(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t *module) +static int +ompi_coll_adapt_ibcast_tuned(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t *module) { OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "tuned not implemented\n")); return OMPI_ERR_NOT_IMPLEMENTED; } -int ompi_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_bmtree(comm, root); - int err = - ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size); - return err; + return ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size); } -int ompi_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_in_order_bmtree(comm, root); - int err = - ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size); - return err; + return ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size); } -int ompi_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_tree(2, comm, root); - int err = - ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size); - return err; + return ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size); } -int ompi_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(1, comm, root); - int err = - ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size); - return err; + return ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size); } -int ompi_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { ompi_coll_tree_t *tree = ompi_coll_base_topo_build_chain(4, comm, root); - int err = - ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size); - return err; + return ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size); } -int ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { int fanout = ompi_comm_size(comm) - 1; ompi_coll_tree_t *tree; @@ -426,10 +435,8 @@ int ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t } else { tree = ompi_coll_base_topo_build_tree(MAXTREEFANOUT, comm, root); } - int err = - ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, - mca_coll_adapt_component.adapt_ibcast_segment_size); - return err; + return ompi_coll_adapt_ibcast_generic(buff, count, datatype, root, comm, request, module, tree, + mca_coll_adapt_component.adapt_ibcast_segment_size); } @@ -482,7 +489,7 @@ int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t temp_request = OBJ_NEW(ompi_request_t); OMPI_REQUEST_INIT(temp_request, false); temp_request->req_state = OMPI_REQUEST_ACTIVE; - temp_request->req_type = 0; + temp_request->req_type = OMPI_REQUEST_COLL; temp_request->req_free = ompi_coll_adapt_request_free; temp_request->req_status.MPI_SOURCE = 0; temp_request->req_status.MPI_TAG = 0; @@ -593,7 +600,7 @@ int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t if (MPI_SUCCESS != err) { return err; } - /* Invoke send call back */ + /* Set send callback */ OPAL_THREAD_UNLOCK(mutex); ompi_request_set_callback(send_req, send_cb, context); OPAL_THREAD_LOCK(mutex); @@ -650,7 +657,7 @@ int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t if (MPI_SUCCESS != err) { return err; } - /* Invoke receive call back */ + /* Set receive callback */ OPAL_THREAD_UNLOCK(mutex); ompi_request_set_callback(recv_req, recv_cb, context); OPAL_THREAD_LOCK(mutex); diff --git a/ompi/mca/coll/adapt/coll_adapt_inbuf.h b/ompi/mca/coll/adapt/coll_adapt_inbuf.h index 93c3060333b..d339256b856 100644 --- a/ompi/mca/coll/adapt/coll_adapt_inbuf.h +++ b/ompi/mca/coll/adapt/coll_adapt_inbuf.h @@ -16,7 +16,7 @@ struct ompi_coll_adapt_inbuf_s { opal_free_list_item_t super; - char buff[1]; + char buff[]; }; typedef struct ompi_coll_adapt_inbuf_s ompi_coll_adapt_inbuf_t; diff --git a/ompi/mca/coll/adapt/coll_adapt_ireduce.c b/ompi/mca/coll/adapt/coll_adapt_ireduce.c index b105181be7a..230c9a60cb8 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ireduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_ireduce.c @@ -22,6 +22,16 @@ #include "ompi/mca/coll/base/coll_base_functions.h" #include "ompi/mca/coll/base/coll_base_topo.h" +static int ompi_coll_adapt_ireduce_tuned(IREDUCE_ARGS); +static int ompi_coll_adapt_ireduce_binomial(IREDUCE_ARGS); +static int ompi_coll_adapt_ireduce_in_order_binomial(IREDUCE_ARGS); +static int ompi_coll_adapt_ireduce_binary(IREDUCE_ARGS); +static int ompi_coll_adapt_ireduce_pipeline(IREDUCE_ARGS); +static int ompi_coll_adapt_ireduce_chain(IREDUCE_ARGS); +static int ompi_coll_adapt_ireduce_linear(IREDUCE_ARGS); +static int ompi_coll_adapt_ireduce_generic(IREDUCE_ARGS, + ompi_coll_tree_t * tree, size_t seg_size); + /* MPI_Reduce and MPI_Ireduce in the ADAPT module only work for commutative operations */ typedef int (*ompi_coll_adapt_ireduce_fn_t) (const void *sbuf, @@ -35,13 +45,13 @@ typedef int (*ompi_coll_adapt_ireduce_fn_t) (const void *sbuf, mca_coll_base_module_t * module); static ompi_coll_adapt_algorithm_index_t ompi_coll_adapt_ireduce_algorithm_index[] = { - {0, (uintptr_t)ompi_coll_adapt_ireduce_tuned}, - {1, (uintptr_t) ompi_coll_adapt_ireduce_binomial}, - {2, (uintptr_t) ompi_coll_adapt_ireduce_in_order_binomial}, - {3, (uintptr_t) ompi_coll_adapt_ireduce_binary}, - {4, (uintptr_t) ompi_coll_adapt_ireduce_pipeline}, - {5, (uintptr_t) ompi_coll_adapt_ireduce_chain}, - {6, (uintptr_t) ompi_coll_adapt_ireduce_linear}, + {0, {.ireduce_fn_ptr = ompi_coll_adapt_ireduce_tuned}}, + {1, {.ireduce_fn_ptr = ompi_coll_adapt_ireduce_binomial}}, + {2, {.ireduce_fn_ptr = ompi_coll_adapt_ireduce_in_order_binomial}}, + {3, {.ireduce_fn_ptr = ompi_coll_adapt_ireduce_binary}}, + {4, {.ireduce_fn_ptr = ompi_coll_adapt_ireduce_pipeline}}, + {5, {.ireduce_fn_ptr = ompi_coll_adapt_ireduce_chain}}, + {6, {.ireduce_fn_ptr = ompi_coll_adapt_ireduce_linear}}, }; /* @@ -56,6 +66,10 @@ int ompi_coll_adapt_ireduce_register(void) "Algorithm of reduce, 1: binomial, 2: in_order_binomial, 3: binary, 4: pipeline, 5: chain, 6: linear", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY, &mca_coll_adapt_component.adapt_ireduce_algorithm); + if( (mca_coll_adapt_component.adapt_ireduce_algorithm < 0) || + (mca_coll_adapt_component.adapt_ireduce_algorithm > (int32_t)(sizeof(ompi_coll_adapt_ireduce_algorithm_index) / sizeof(ompi_coll_adapt_algorithm_index_t))) ) { + mca_coll_adapt_component.adapt_ireduce_algorithm = 1; + } mca_coll_adapt_component.adapt_ireduce_segment_size = 163740; mca_base_component_var_register(c, "reduce_segment_size", @@ -197,7 +211,7 @@ static int ireduce_request_fini(ompi_coll_adapt_reduce_context_t * context) } OBJ_RELEASE(context->con->recv_list); for (i = 0; i < context->con->num_segs; i++) { - OBJ_RELEASE(context->con->mutex_op_list[i]); + OBJ_DESTRUCT(&context->con->mutex_op_list[i]); } free(context->con->mutex_op_list); OBJ_RELEASE(context->con->mutex_num_recv_segs); @@ -279,7 +293,7 @@ static int send_cb(ompi_request_t * req) /* Release the item */ OBJ_RELEASE(item); - /* Invoke send call back */ + /* Set the send callback */ ompi_request_set_callback(send_req, send_cb, send_context); } @@ -366,7 +380,7 @@ static int recv_cb(ompi_request_t * req) if (MPI_SUCCESS != err) { return err; } - /* Invoke receive call back */ + /* Set the receive callback */ ompi_request_set_callback(recv_req, recv_cb, recv_context); } @@ -377,7 +391,7 @@ static int recv_cb(ompi_request_t * req) } int keep_inbuf = 0; - OPAL_THREAD_LOCK(context->con->mutex_op_list[context->frag_id]); + OPAL_THREAD_LOCK(&context->con->mutex_op_list[context->frag_id]); if (context->con->accumbuf[context->frag_id] == NULL) { if (context->inbuf == NULL) { OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, @@ -424,7 +438,7 @@ static int recv_cb(ompi_request_t * req) } } - OPAL_THREAD_UNLOCK(context->con->mutex_op_list[context->frag_id]); + OPAL_THREAD_UNLOCK(&context->con->mutex_op_list[context->frag_id]); /* Set recv list */ if (context->con->rank != context->con->tree->tree_root) { @@ -474,7 +488,7 @@ static int recv_cb(ompi_request_t * req) } OBJ_RELEASE(item); - /* Invoke send call back */ + /* Set the send callback */ ompi_request_set_callback(send_req, send_cb, send_context); } } @@ -529,60 +543,63 @@ int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi mca_coll_adapt_component.adapt_ireduce_max_recv_requests)); ompi_coll_adapt_ireduce_fn_t reduce_func = - (ompi_coll_adapt_ireduce_fn_t) - ompi_coll_adapt_ireduce_algorithm_index[mca_coll_adapt_component. - adapt_ireduce_algorithm].algorithm_fn_ptr; + ompi_coll_adapt_ireduce_algorithm_index[mca_coll_adapt_component.adapt_ireduce_algorithm].ireduce_fn_ptr; return reduce_func(sbuf, rbuf, count, dtype, op, root, comm, request, module); } /* * Ireduce functions with different algorithms */ -int ompi_coll_adapt_ireduce_tuned(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t *module) +static int +ompi_coll_adapt_ireduce_tuned(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t *module) { OPAL_OUTPUT_VERBOSE((10, mca_coll_adapt_component.adapt_output, "tuned not implemented\n")); return OMPI_ERR_NOT_IMPLEMENTED; } -int ompi_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, ompi_coll_base_topo_build_bmtree(comm, root), mca_coll_adapt_component.adapt_ireduce_segment_size); } -int ompi_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, - int root, struct ompi_communicator_t *comm, - ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, + int root, struct ompi_communicator_t *comm, + ompi_request_t ** request, + mca_coll_base_module_t * module) { return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, ompi_coll_base_topo_build_in_order_bmtree(comm, root), mca_coll_adapt_component.adapt_ireduce_segment_size); } -int ompi_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, ompi_coll_base_topo_build_tree(2, comm, root), mca_coll_adapt_component.adapt_ireduce_segment_size); } -int ompi_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, ompi_coll_base_topo_build_chain(1, comm, root), @@ -590,20 +607,22 @@ int ompi_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count, } -int ompi_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { return ompi_coll_adapt_ireduce_generic(sbuf, rbuf, count, dtype, op, root, comm, request, module, ompi_coll_base_topo_build_chain(4, comm, root), mca_coll_adapt_component.adapt_ireduce_segment_size); } -int ompi_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, - struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - mca_coll_base_module_t * module) +static int +ompi_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count, + struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root, + struct ompi_communicator_t *comm, ompi_request_t ** request, + mca_coll_base_module_t * module) { int fanout = ompi_comm_size(comm) - 1; ompi_coll_tree_t *tree; @@ -640,7 +659,7 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, opal_mutex_t *mutex_recv_list; opal_mutex_t *mutex_num_recv_segs; opal_mutex_t *mutex_num_sent; - opal_mutex_t **mutex_op_list; + opal_mutex_t *mutex_op_list; /* A list to store the segments need to be sent */ opal_list_t *recv_list; @@ -706,7 +725,7 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, temp_request = OBJ_NEW(ompi_request_t); OMPI_REQUEST_INIT(temp_request, false); temp_request->req_state = OMPI_REQUEST_ACTIVE; - temp_request->req_type = 0; + temp_request->req_type = OMPI_REQUEST_COLL; temp_request->req_free = ompi_coll_adapt_request_free; temp_request->req_status.MPI_SOURCE = 0; temp_request->req_status.MPI_TAG = 0; @@ -718,9 +737,9 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, /* Set up mutex */ mutex_recv_list = OBJ_NEW(opal_mutex_t); mutex_num_recv_segs = OBJ_NEW(opal_mutex_t); - mutex_op_list = (opal_mutex_t **) malloc(sizeof(opal_mutex_t *) * num_segs); + mutex_op_list = (opal_mutex_t *) malloc(sizeof(opal_mutex_t) * num_segs); for (i = 0; i < num_segs; i++) { - mutex_op_list[i] = OBJ_NEW(opal_mutex_t); + OBJ_CONSTRUCT(&mutex_op_list[i], opal_mutex_t); } mutex_num_sent = OBJ_NEW(opal_mutex_t); /* Create recv_list */ @@ -837,7 +856,7 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, if (MPI_SUCCESS != err) { return err; } - /* Invoke recv call back */ + /* Set the recv callback */ ompi_request_set_callback(recv_req, recv_cb, context); } } @@ -899,7 +918,7 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, } OBJ_RELEASE(item); - /* Invoke send call back */ + /* Set the send callback */ ompi_request_set_callback(send_req, send_cb, context); } } From 57b95bcb45d5ce3ae1a1e00bd17ceeaa206526fe Mon Sep 17 00:00:00 2001 From: William Zhang Date: Tue, 25 Aug 2020 08:41:23 -0700 Subject: [PATCH 14/31] coll/tuned: Revert RSB and RS default algorithms Reduce scatter block and reduce scatter algorithms were hitting correctness issues for non commutative strided tests. We will revert to the original default algorithms for those two collectives (basic linear and non overlapping respectively) in the non commutative op case. See #8010 Signed-off-by: William Zhang --- .../coll/tuned/coll_tuned_decision_fixed.c | 136 +----------------- 1 file changed, 6 insertions(+), 130 deletions(-) diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c index d06f3ea19fe..cc73fcf835b 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c @@ -883,64 +883,11 @@ int ompi_coll_tuned_reduce_scatter_intra_dec_fixed( const void *sbuf, void *rbuf * {3, "ring"}, * {4, "butterfly"}, * - * Recursive halving and ring do not support non commutative ops. + * Non commutative algorithm capability needs re-investigation. + * Defaulting to non overlapping for non commutative ops. */ if (!ompi_op_is_commute(op)) { - if (communicator_size < 4) { - if (total_dsize < 262144) { - alg = 4; - } else { - alg = 1; - } - } else if (communicator_size < 8) { - if (total_dsize < 16) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 16) { - if (total_dsize < 32) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 32) { - if (total_dsize < 64) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 64) { - if (total_dsize < 128) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 128) { - if (total_dsize < 256) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 1024) { - if (total_dsize < 512) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 2048) { - if (total_dsize < 1024) { - alg = 1; - } else { - alg = 4; - } - } else { - if (total_dsize < 2048) { - alg = 1; - } else { - alg = 4; - } - } + alg = 1; } else { if (communicator_size < 4) { if (total_dsize < 65536) { @@ -1082,82 +1029,11 @@ int ompi_coll_tuned_reduce_scatter_block_intra_dec_fixed(const void *sbuf, void * {3, "recursive_halving"}, * {4, "butterfly"}, * - * Only recursive halving does not support non commutative ops. + * Non commutative algorithm capability needs re-investigation. + * Defaulting to basic linear for non commutative ops. */ if( !ompi_op_is_commute(op) ) { - if (communicator_size < 4) { - if (total_dsize < 4) { - alg = 2; - } else if (total_dsize < 131072) { - alg = 4; - } else { - alg = 1; - } - } else if (communicator_size < 8) { - if (total_dsize < 4) { - alg = 1; - } else if (total_dsize < 32) { - alg = 2; - } else if (total_dsize < 1048576) { - alg = 4; - } else { - alg = 1; - } - } else if (communicator_size < 16) { - if (total_dsize < 4) { - alg = 1; - } else if (total_dsize < 524288) { - alg = 4; - } else if (total_dsize < 4194304) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 32) { - if (total_dsize < 128) { - alg = 1; - } else if (total_dsize < 262144) { - alg = 4; - } else if (total_dsize < 2097152) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 64) { - if (total_dsize < 64) { - alg = 1; - } else if (total_dsize < 65536) { - alg = 4; - } else if (total_dsize < 1048576) { - alg = 1; - } else { - alg = 4; - } - } else if (communicator_size < 128) { - if (total_dsize < 4) { - alg = 4; - } else if (total_dsize < 64) { - alg = 1; - } else if (total_dsize < 131072) { - alg = 4; - } else if (total_dsize < 524288) { - alg = 1; - } else { - alg = 4; - } - } else { - if (total_dsize < 4) { - alg = 4; - } else if (total_dsize < 16) { - alg = 1; - } else if (total_dsize < 65536) { - alg = 4; - } else if (total_dsize < 262144) { - alg = 1; - } else { - alg = 4; - } - } + alg = 1; } else { if (communicator_size < 4) { if (total_dsize < 4) { From d6ac41cbbd8dbfdbf1a87533e2e292f2508a85ff Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 13 Aug 2020 11:49:43 -0600 Subject: [PATCH 15/31] OFI: patch OFI MTL for GNI provider Uncovered a problem using the GNI provider with the OFI MTL. See https://github.com/ofiwg/libfabric/issues/6194. Related to #8001 Signed-off-by: Howard Pritchard --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 42abfff7216..2a6f194b46c 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -940,6 +940,17 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, goto error; } + /** + * Unfortunately the attempt to implement FI_MR_SCALABLE in the GNI provider + * doesn't work, at least not well. Since we're asking for the 1.5 libfabric + * API now, we have to tell GNI we want to use Mr. Basic. Using FI_MR_BASIC + * rather than FI_MR_VIRT_ADDR | FI_MR_ALLOCATED | FI_MR_PROV_KEY to stay + * compatible with older libfabrics. + */ + if (!strncmp(prov->fabric_attr->prov_name,"gni",3)) { + prov->domain_attr->mr_mode = FI_MR_BASIC; + } + /** * Create the access domain, which is the physical or virtual network or * hardware port/collection of ports. Returns a domain object that can be From 4df5fcf48ca0874bd136e249f6958ecca7f58d9a Mon Sep 17 00:00:00 2001 From: Aurelien Bouteiller Date: Wed, 26 Aug 2020 16:05:30 -0400 Subject: [PATCH 16/31] errors_are_fatal_comm_handler takes a pointer to the error constant as input. Signed-off-by: Aurelien Bouteiller --- ompi/mca/pml/ob1/pml_ob1.c | 2 +- ompi/mca/pml/ob1/pml_ob1_recvreq.h | 3 ++- ompi/mca/pml/ob1/pml_ob1_sendreq.h | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ompi/mca/pml/ob1/pml_ob1.c b/ompi/mca/pml/ob1/pml_ob1.c index 5dc69af4b83..0dcb0c71229 100644 --- a/ompi/mca/pml/ob1/pml_ob1.c +++ b/ompi/mca/pml/ob1/pml_ob1.c @@ -829,7 +829,7 @@ void mca_pml_ob1_error_handler( /* TODO: this error should return to the caller and invoke an error * handler from the MPI API call. * For now, it is fatal. */ - ompi_mpi_errors_are_fatal_comm_handler(NULL, -1, btlinfo); + ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, btlinfo); } #if OPAL_ENABLE_FT_CR == 0 diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.h b/ompi/mca/pml/ob1/pml_ob1_recvreq.h index b57b4f49163..bd3aff3f95a 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.h +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.h @@ -181,7 +181,8 @@ recv_request_pml_complete(mca_pml_ob1_recv_request_t *recvreq) if( MPI_SUCCESS != recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR ) { /* An error after freeing the request MUST be fatal * MPI3 ch3.7: MPI_REQUEST_FREE */ - ompi_mpi_errors_are_fatal_comm_handler(NULL, MPI_ERR_REQUEST, "Recv error after request freed"); + int err = MPI_ERR_REQUEST; + ompi_mpi_errors_are_fatal_comm_handler(NULL, &err, "Recv error after request freed"); } MCA_PML_OB1_RECV_REQUEST_RETURN(recvreq); } else { diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.h b/ompi/mca/pml/ob1/pml_ob1_sendreq.h index 6d9a37265c4..cd202e7583c 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.h +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.h @@ -278,7 +278,8 @@ send_request_pml_complete(mca_pml_ob1_send_request_t *sendreq) if( MPI_SUCCESS != sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR ) { /* An error after freeing the request MUST be fatal * MPI3 ch3.7: MPI_REQUEST_FREE */ - ompi_mpi_errors_are_fatal_comm_handler(NULL, MPI_ERR_REQUEST, "Send error after request freed"); + int err = MPI_ERR_REQUEST; + ompi_mpi_errors_are_fatal_comm_handler(NULL, &err, "Send error after request freed"); } } } else { From 4d420348f717e2d08857022ebe5c2ff5414fc954 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Mon, 31 Aug 2020 09:21:26 +0200 Subject: [PATCH 17/31] Fix MPI versions in MPI.3 manpage Thanks to Andy Riebs for reporting that on the Open MPI user mailing list (https://www.mail-archive.com/users@lists.open-mpi.org/msg34103.html) Signed-off-by: Joseph Schuchart --- ompi/mpi/man/man5/Open-MPI.5.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mpi/man/man5/Open-MPI.5.md b/ompi/mpi/man/man5/Open-MPI.5.md index 0748efc6988..78c97399f45 100644 --- a/ompi/mpi/man/man5/Open-MPI.5.md +++ b/ompi/mpi/man/man5/Open-MPI.5.md @@ -16,8 +16,8 @@ message-passing programs that would be efficient, flexible, and portable. The outcome, known as the MPI Standard, was first published in 1993; its -most recent version (MPI-2) was published in July 1997. Open MPI 1.2 -includes all MPI 1.2-compliant and MPI 2-compliant routines. +most recent version (MPI-3.1) was published in June 2015. Open MPI +includes all MPI 3.1-compliant routines. For more information about Open MPI, see [https://www.open-mpi.org](https://www.open-mpi.org). From 556a4ac0da2d69f003df91593d34fcf931fe390d Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 31 Aug 2020 13:07:32 -0600 Subject: [PATCH 18/31] btl: remove unused descriptor flags This PR removes the MCA_BTL_DES_FLAGS_PUT and MCA_BTL_DES_FLAGS_GET descriptor flags. At some point these had some meaning but they were replaced by the rcache access flags. Signed-off-by: Nathan Hjelm --- opal/mca/btl/btl.h | 5 ----- opal/mca/btl/ofi/btl_ofi_module.c | 6 +++--- opal/mca/btl/template/btl_template.c | 6 +++--- opal/mca/btl/template/btl_template.h | 6 +++--- opal/mca/btl/uct/btl_uct_module.c | 6 +++--- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/opal/mca/btl/btl.h b/opal/mca/btl/btl.h index df06b0df4bc..44a4d32469f 100644 --- a/opal/mca/btl/btl.h +++ b/opal/mca/btl/btl.h @@ -491,11 +491,6 @@ OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_btl_base_descriptor_t); */ #define MCA_BTL_DES_FLAGS_CUDA_COPY_ASYNC 0x0008 -/* Type of transfer that will be done with this frag. - */ -#define MCA_BTL_DES_FLAGS_PUT 0x0010 -#define MCA_BTL_DES_FLAGS_GET 0x0020 - /* Ask the BTL to wake the remote process (send/sendi) or local process * (put/get) to handle this message. The BTL may ignore this flag if * signaled operations are not supported. diff --git a/opal/mca/btl/ofi/btl_ofi_module.c b/opal/mca/btl/ofi/btl_ofi_module.c index 9bc088749c5..b32a1f106a7 100644 --- a/opal/mca/btl/ofi/btl_ofi_module.c +++ b/opal/mca/btl/ofi/btl_ofi_module.c @@ -15,6 +15,7 @@ * Copyright (c) 2018 Intel, Inc, All rights reserved * * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -169,9 +170,8 @@ void mca_btl_ofi_rcache_init (mca_btl_ofi_module_t *module) * @param endpoint(IN) BTL addressing information (or NULL for all endpoints) * @param base (IN) Pointer to start of region * @param size (IN) Size of region - * @param flags (IN) Flags indicating what operation will be performed. Valid - * values are MCA_BTL_DES_FLAGS_PUT, MCA_BTL_DES_FLAGS_GET, - * and MCA_BTL_DES_FLAGS_ATOMIC + * @param flags (IN) Flags indicating what memory access level is requested. + * See opal/mca/rcache/rcache.h for valid access flags. * * @returns a memory registration handle valid for both local and remote operations * @returns NULL if the region could not be registered diff --git a/opal/mca/btl/template/btl_template.c b/opal/mca/btl/template/btl_template.c index 7c89a93b843..5a9dae3f0f4 100644 --- a/opal/mca/btl/template/btl_template.c +++ b/opal/mca/btl/template/btl_template.c @@ -12,6 +12,7 @@ * All rights reserved. * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -349,9 +350,8 @@ int mca_btl_template_get (struct mca_btl_base_module_t *btl, * @param endpoint(IN) BTL addressing information (or NULL for all endpoints) * @param base (IN) Pointer to start of region * @param size (IN) Size of region - * @param flags (IN) Flags indicating what operation will be performed. Valid - * values are MCA_BTL_DES_FLAGS_PUT, MCA_BTL_DES_FLAGS_GET, - * and MCA_BTL_DES_FLAGS_ATOMIC + * @param flags (IN) Flags indicating what memory access level is requested. + * See opal/mca/rcache/rcache.h for valid access flags. * * @returns a memory registration handle valid for both local and remote operations * @returns NULL if the region could not be registered diff --git a/opal/mca/btl/template/btl_template.h b/opal/mca/btl/template/btl_template.h index 06268e0e033..98723e6c1ce 100644 --- a/opal/mca/btl/template/btl_template.h +++ b/opal/mca/btl/template/btl_template.h @@ -12,6 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -268,9 +269,8 @@ int mca_btl_template_get (struct mca_btl_base_module_t *btl, * @param endpoint(IN) BTL addressing information (or NULL for all endpoints) * @param base (IN) Pointer to start of region * @param size (IN) Size of region - * @param flags (IN) Flags indicating what operation will be performed. Valid - * values are MCA_BTL_DES_FLAGS_PUT, MCA_BTL_DES_FLAGS_GET, - * and MCA_BTL_DES_FLAGS_ATOMIC + * @param flags (IN) Flags indicating what memory access level is requested. + * See opal/mca/rcache/rcache.h for valid access flags. * * @returns a memory registration handle valid for both local and remote operations * @returns NULL if the region could not be registered diff --git a/opal/mca/btl/uct/btl_uct_module.c b/opal/mca/btl/uct/btl_uct_module.c index f0802867546..53d1df3302f 100644 --- a/opal/mca/btl/uct/btl_uct_module.c +++ b/opal/mca/btl/uct/btl_uct_module.c @@ -12,6 +12,7 @@ * All rights reserved. * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -149,9 +150,8 @@ static int mca_btl_uct_del_procs (mca_btl_base_module_t *btl, size_t nprocs, * @param endpoint(IN) BTL addressing information (or NULL for all endpoints) * @param base (IN) Pointer to start of region * @param size (IN) Size of region - * @param flags (IN) Flags indicating what operation will be performed. Valid - * values are MCA_BTL_DES_FLAGS_PUT, MCA_BTL_DES_FLAGS_GET, - * and MCA_BTL_DES_FLAGS_ATOMIC + * @param flags (IN) Flags indicating what memory access level is requested. + * See opal/mca/rcache/rcache.h for valid access flags. * * @returns a memory registration handle valid for both local and remote operations * @returns NULL if the region could not be registered From fc025c78dfb058607933cfb8a24108e94c19cc43 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Fri, 4 Sep 2020 09:31:18 +0200 Subject: [PATCH 19/31] UCX: do not dereference NULL pointer in wpmem_[free|flush] Flushing or freeing a newly created dynamic window causes NULL to be passed. Signed-off-by: Joseph Schuchart --- opal/mca/common/ucx/common_ucx_wpool.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/opal/mca/common/ucx/common_ucx_wpool.c b/opal/mca/common/ucx/common_ucx_wpool.c index 25e28e8e159..dd4c13ec3c2 100644 --- a/opal/mca/common/ucx/common_ucx_wpool.c +++ b/opal/mca/common/ucx/common_ucx_wpool.c @@ -528,6 +528,10 @@ static int _comm_ucx_wpmem_map(opal_common_ucx_wpool_t *wpool, void opal_common_ucx_wpmem_free(opal_common_ucx_wpmem_t *mem) { _mem_record_t *mem_rec = NULL, *next; + + if (NULL == mem) { + return; + } OBJ_DESTRUCT(&mem->tls_key); @@ -824,9 +828,14 @@ opal_common_ucx_wpmem_flush(opal_common_ucx_wpmem_t *mem, int target) { _ctx_record_t *ctx_rec; - opal_common_ucx_ctx_t *ctx = mem->ctx; + opal_common_ucx_ctx_t *ctx; int rc = OPAL_SUCCESS; + if (NULL == mem) { + return OPAL_SUCCESS; + } + + ctx = mem->ctx; opal_mutex_lock(&ctx->mutex); OPAL_LIST_FOREACH(ctx_rec, &ctx->ctx_records, _ctx_record_t) { From b78c7e93db1a1e6ec90404abdc259cea90d9339d Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Wed, 9 Sep 2020 09:05:30 +0200 Subject: [PATCH 20/31] Use correct conditional variable initializer in opal/mca/pmix/base Signed-off-by: Joseph Schuchart --- opal/mca/pmix/base/base.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/pmix/base/base.h b/opal/mca/pmix/base/base.h index 6021870799a..323a92f9800 100644 --- a/opal/mca/pmix/base/base.h +++ b/opal/mca/pmix/base/base.h @@ -46,7 +46,7 @@ typedef struct { extern opal_pmix_base_t opal_pmix_base; -#define OPAL_PMIX_CONDITION_STATIC_INIT PTHREAD_COND_INITIALIZER +#define OPAL_PMIX_CONDITION_STATIC_INIT OPAL_CONDITION_STATIC_INIT END_C_DECLS From 7fce2f3057d6baaba688c99ad5602407df21128d Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 21 Jul 2020 22:10:31 +0900 Subject: [PATCH 21/31] update MPI_F08_status type Make the C MPI_F08_status type definition match the updated mpi_f08 type(MPI_Status) definition. This fix the inconsistency introduced in open-mpi/ompi@98bc7af7d4dce3fe9106ffff39c0b129b9466d40 Signed-off-by: Gilles Gouaillardet --- config/ompi_setup_mpi_fortran.m4 | 5 ++++- ompi/include/mpi.h.in | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/config/ompi_setup_mpi_fortran.m4 b/config/ompi_setup_mpi_fortran.m4 index bfabf40d102..adb40ecc06b 100644 --- a/config/ompi_setup_mpi_fortran.m4 +++ b/config/ompi_setup_mpi_fortran.m4 @@ -15,7 +15,7 @@ dnl Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. -dnl Copyright (c) 2014-2019 Research Organization for Information Science +dnl Copyright (c) 2014-2020 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 IBM Corporation. All rights reserved. dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. @@ -276,6 +276,9 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[ OMPI_FORTRAN_STATUS_SIZE=$num_ints AC_MSG_RESULT([$OMPI_FORTRAN_STATUS_SIZE Fortran INTEGERs]) AC_SUBST(OMPI_FORTRAN_STATUS_SIZE) + AC_DEFINE_UNQUOTED([OMPI_FORTRAN_STATUS_SIZE], + [$OMPI_FORTRAN_STATUS_SIZE], + [The number or Fortran INTEGER in MPI Status]) # Setup for the compilers that don't support ignore TKR functionality OPAL_UNIQ(OMPI_FORTRAN_IKINDS) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index e74372657d7..2368d9df1e8 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -17,8 +17,8 @@ * reserved. * Copyright (c) 2011-2013 INRIA. All rights reserved. * Copyright (c) 2015 University of Houston. All rights reserved. - * Copyright (c) 2015-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -98,6 +98,9 @@ /* Maximum length of processor names (default is 256) */ #undef OPAL_MAX_PROCESSOR_NAME +/* The number or Fortran INTEGER in MPI Status */ +#undef OMPI_FORTRAN_STATUS_SIZE + /* Whether we have FORTRAN LOGICAL*1 or not */ #undef OMPI_HAVE_FORTRAN_LOGICAL1 @@ -432,6 +435,19 @@ struct ompi_status_public_t { }; typedef struct ompi_status_public_t ompi_status_public_t; +/* + * MPI_F08_status + */ +struct ompi_f08_status_public_t { + /* These fields are publicly defined in the MPI specification. + User applications may freely read from these fields. */ + MPI_Fint MPI_SOURCE; + MPI_Fint MPI_TAG; + MPI_Fint MPI_ERROR; + MPI_Fint internal[OMPI_FORTRAN_STATUS_SIZE - 3]; +}; +typedef struct ompi_f08_status_public_t ompi_f08_status_public_t; + /* * User typedefs */ From 466a2b31e08e2b4bb4c169d65f101900ca0c4aea Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 22 Jul 2020 22:40:57 +0900 Subject: [PATCH 22/31] configury: cleanup .mod file manually cleanup the generated .mod file in OMPI_FORTRAN_CHECK_BIND_C_TYPE Signed-off-by: Gilles Gouaillardet --- config/ompi_fortran_check_bind_c.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/ompi_fortran_check_bind_c.m4 b/config/ompi_fortran_check_bind_c.m4 index bcdf6e31872..d7e10e1fa54 100644 --- a/config/ompi_fortran_check_bind_c.m4 +++ b/config/ompi_fortran_check_bind_c.m4 @@ -11,6 +11,8 @@ dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2020 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -83,6 +85,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_BIND_C_TYPE],[ end module]])], [AS_VAR_SET(bind_c_type_var, yes)], [AS_VAR_SET(bind_c_type_var, no)]) + rm -rf *.mod 2>/dev/null AC_LANG_POP([Fortran]) ]) From e97d3ce6454865de612796aaa2c065775fca253d Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 21 Jul 2020 22:11:10 +0900 Subject: [PATCH 23/31] Add missing MPI_Status conversion subroutines Only in C bindings: - MPI_Status_c2f08() - MPI_Status_f082c() In all bindings but mpif.h - MPI_Status_f082f() - MPI_Status_f2f08() and the PMPI_* related subroutines As initially inteded by the MPI forum, the Fortran to/from Fortran 2008 conversion subtoutines are *not* implemented in the mpif.h bindings. See the discussion at https://github.com/mpi-forum/mpi-issues/issues/298 Refs. open-mpi/ompi#1475 Signed-off-by: Gilles Gouaillardet --- config/ompi_config_files.m4 | 6 +- config/ompi_setup_mpi_fortran.m4 | 38 +++++--- ompi/Makefile.am | 6 +- ompi/include/mpi.h.in | 9 ++ ompi/mpi/c/Makefile.am | 8 +- ompi/mpi/c/profile/Makefile.am | 8 +- ompi/mpi/c/status_c2f.c | 3 +- ompi/mpi/c/status_c2f08.c | 87 +++++++++++++++++++ ompi/mpi/c/status_f082c.c | 85 ++++++++++++++++++ ompi/mpi/c/status_f082f.c | 71 +++++++++++++++ ompi/mpi/c/status_f2c.c | 3 +- ompi/mpi/c/status_f2f08.c | 73 ++++++++++++++++ .../mpi/fortran/configure-fortran-output.h.in | 4 +- .../fortran/mpiext-use-mpi-f08/Makefile.am | 5 +- ompi/mpi/fortran/mpiext-use-mpi/Makefile.am | 5 +- ompi/mpi/fortran/mpif-h/Makefile.am | 6 +- ompi/mpi/fortran/mpif-h/profile/Makefile.am | 6 +- ompi/mpi/fortran/mpif-h/prototypes_mpi.h | 6 +- ompi/mpi/fortran/mpif-h/status_f082f_f.c | 65 ++++++++++++++ ompi/mpi/fortran/mpif-h/status_f2f08_f.c | 65 ++++++++++++++ ompi/mpi/fortran/use-mpi-f08/Makefile.am | 7 +- ompi/mpi/fortran/use-mpi-f08/base/Makefile.am | 4 +- .../fortran/use-mpi-f08/bindings/Makefile.am | 5 +- .../bindings/mpi-f-interfaces-bind.h | 20 ++++- ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am | 6 +- .../use-mpi-f08/mod/mpi-f08-interfaces.F90 | 24 ++++- .../fortran/use-mpi-f08/mod/mpi-f08-types.F90 | 21 +---- .../use-mpi-f08/mod/pmpi-f08-interfaces.F90 | 24 ++++- .../use-mpi-f08/profile/pstatus_f082f_f08.F90 | 19 ++++ .../use-mpi-f08/profile/pstatus_f2f08_f08.F90 | 19 ++++ .../fortran/use-mpi-f08/status_f082f_f08.F90 | 19 ++++ .../fortran/use-mpi-f08/status_f2f08_f08.F90 | 19 ++++ .../fortran/use-mpi-ignore-tkr/Makefile.am | 16 +++- .../mpi-ignore-tkr-status.h | 61 +++++++++++++ .../use-mpi-ignore-tkr/mpi-ignore-tkr.F90 | 10 ++- ompi/mpi/fortran/use-mpi-tkr/Makefile.am | 15 +++- ompi/mpi/fortran/use-mpi-tkr/mpi-f90-status.h | 35 ++++++++ ompi/mpi/fortran/use-mpi-tkr/mpi.F90 | 11 ++- .../mpi/fortran/use-mpi-tkr/pmpi-f90-status.h | 35 ++++++++ ompi/mpi/fortran/use-mpi/Makefile.am | 67 ++++++++++++++ ompi/mpi/fortran/use-mpi/mpi-types.F90.in | 39 +++++++++ ompi/mpi/man/man3/MPI_Status_c2f08.3in | 1 + ompi/mpi/man/man3/MPI_Status_f082c.3in | 30 +++++++ ompi/mpi/man/man3/MPI_Status_f082f.3in | 56 ++++++++++++ ompi/mpi/man/man3/MPI_Status_f2f08.3in | 1 + ompi/mpi/man/man3/Makefile.am | 6 ++ ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am | 5 +- 47 files changed, 1060 insertions(+), 74 deletions(-) create mode 100644 ompi/mpi/c/status_c2f08.c create mode 100644 ompi/mpi/c/status_f082c.c create mode 100644 ompi/mpi/c/status_f082f.c create mode 100644 ompi/mpi/c/status_f2f08.c create mode 100644 ompi/mpi/fortran/mpif-h/status_f082f_f.c create mode 100644 ompi/mpi/fortran/mpif-h/status_f2f08_f.c create mode 100644 ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f082f_f08.F90 create mode 100644 ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f2f08_f08.F90 create mode 100644 ompi/mpi/fortran/use-mpi-f08/status_f082f_f08.F90 create mode 100644 ompi/mpi/fortran/use-mpi-f08/status_f2f08_f08.F90 create mode 100644 ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h create mode 100644 ompi/mpi/fortran/use-mpi-tkr/mpi-f90-status.h create mode 100644 ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-status.h create mode 100644 ompi/mpi/fortran/use-mpi/Makefile.am create mode 100644 ompi/mpi/fortran/use-mpi/mpi-types.F90.in create mode 100644 ompi/mpi/man/man3/MPI_Status_c2f08.3in create mode 100644 ompi/mpi/man/man3/MPI_Status_f082c.3in create mode 100644 ompi/mpi/man/man3/MPI_Status_f082f.3in create mode 100644 ompi/mpi/man/man3/MPI_Status_f2f08.3in diff --git a/config/ompi_config_files.m4 b/config/ompi_config_files.m4 index 15e68599247..1a2003961da 100644 --- a/config/ompi_config_files.m4 +++ b/config/ompi_config_files.m4 @@ -1,8 +1,8 @@ # -*- shell-script -*- # # Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved -# Copyright (c) 2017-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2017-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2018 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. @@ -29,6 +29,8 @@ AC_DEFUN([OMPI_CONFIG_FILES],[ ompi/mpi/fortran/base/Makefile ompi/mpi/fortran/mpif-h/Makefile ompi/mpi/fortran/mpif-h/profile/Makefile + ompi/mpi/fortran/use-mpi/Makefile + ompi/mpi/fortran/use-mpi/mpi-types.F90 ompi/mpi/fortran/use-mpi-tkr/Makefile ompi/mpi/fortran/use-mpi-tkr/fortran_sizes.h ompi/mpi/fortran/use-mpi-tkr/fortran_kinds.sh diff --git a/config/ompi_setup_mpi_fortran.m4 b/config/ompi_setup_mpi_fortran.m4 index adb40ecc06b..fbfd9c5fcf1 100644 --- a/config/ompi_setup_mpi_fortran.m4 +++ b/config/ompi_setup_mpi_fortran.m4 @@ -387,6 +387,18 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[ [OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS AC_MSG_RESULT([no])]) + OMPI_FORTRAN_HAVE_BIND_C_TYPE=0 + OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS=0 + + AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS], + [OMPI_FORTRAN_CHECK_BIND_C_TYPE( + [OMPI_FORTRAN_HAVE_BIND_C_TYPE=1 + OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS=1])]) + + AC_SUBST(OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS) + AM_CONDITIONAL(OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS, + [test $OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS -eq 1]) + #--------------------------------- # Fortran use mpi_f08 MPI bindings #--------------------------------- @@ -422,14 +434,11 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[ [OMPI_FORTRAN_HAVE_BIND_C_SUB=0 OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])]) - OMPI_FORTRAN_HAVE_BIND_C_TYPE=0 AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \ test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS], [ # If we don't have TYPE, BIND(C), we won't build mpi_f08 at all - OMPI_FORTRAN_CHECK_BIND_C_TYPE( - [OMPI_FORTRAN_HAVE_BIND_C_TYPE=1], - [OMPI_FORTRAN_HAVE_BIND_C_TYPE=0 - OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])]) + AS_IF([test $OMPI_FORTRAN_HAVE_BIND_C_TYPE -ne 1], + [OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])]) # Per discussion on the devel list starting here: # https://www.open-mpi.org/community/lists/devel/2014/01/13799.php @@ -701,6 +710,16 @@ end type test_mpi_handle], AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS, [test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \ test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1]) + # True if we support TYPE, BIND(C) + AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE, + [$OMPI_FORTRAN_HAVE_BIND_C_TYPE], + [For ompi_info: Whether the compiler supports TYPE, BIND(C) or not]) + + # For mpif-status.h, configure-fortran-output.h, mpi-f08-types.F90 (and ompi_info) + AC_SUBST([OMPI_FORTRAN_HAVE_PRIVATE]) + AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PRIVATE], + [$OMPI_FORTRAN_HAVE_PRIVATE], + [For mpif-status.h, mpi-f08-types.f90 and ompi_info: whether the compiler supports the "private" keyword or not (used in TYPE(MPI_Status))]) # ------------------- # use mpi_f08 final setup @@ -749,9 +768,6 @@ end type test_mpi_handle], AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_SUB, [$OMPI_FORTRAN_HAVE_BIND_C_SUB], [For ompi_info: Whether the compiler supports SUBROUTINE ... BIND(C) or not]) - AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE, - [$OMPI_FORTRAN_HAVE_BIND_C_TYPE], - [For ompi_info: Whether the compiler supports TYPE, BIND(C) or not]) AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME, [$OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME], [For ompi_info: Whether the compiler supports TYPE, BIND(C, NAME="name") or not]) @@ -759,12 +775,6 @@ end type test_mpi_handle], [$OMPI_FORTRAN_HAVE_OPTIONAL_ARGS], [For ompi_info: whether the Fortran compiler supports optional arguments or not]) - # For configure-fortran-output.h, mpi-f08-types.F90 (and ompi_info) - AC_SUBST([OMPI_FORTRAN_HAVE_PRIVATE]) - AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PRIVATE], - [$OMPI_FORTRAN_HAVE_PRIVATE], - [For mpi-f08-types.f90 and ompi_info: whether the compiler supports the "private" keyword or not (used in MPI_Status)]) - # For configure-fortran-output.h, mpi-f08-interfaces-callbacks.F90 # (and ompi_info) AC_SUBST([OMPI_FORTRAN_HAVE_ABSTRACT]) diff --git a/ompi/Makefile.am b/ompi/Makefile.am index b0791efa0ad..b3952e375a5 100644 --- a/ompi/Makefile.am +++ b/ompi/Makefile.am @@ -15,8 +15,8 @@ # Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. -# Copyright (c) 2015-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ @@ -88,6 +88,7 @@ SUBDIRS = \ . \ $(OMPI_MPIEXT_MPIFH_DIRS) \ mpi/fortran/mpif-h \ + mpi/fortran/use-mpi \ $(OMPI_MPIEXT_USEMPI_DIR) \ $(OMPI_FORTRAN_USEMPI_DIR) \ mpi/fortran/mpiext-use-mpi \ @@ -121,6 +122,7 @@ DIST_SUBDIRS = \ mpi/tool \ mpi/fortran/base \ mpi/fortran/mpif-h \ + mpi/fortran/use-mpi \ mpi/fortran/use-mpi-tkr \ mpi/fortran/use-mpi-ignore-tkr \ mpi/fortran/mpiext-use-mpi \ diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 2368d9df1e8..7079f3335a2 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -411,6 +411,7 @@ typedef struct ompi_op_t *MPI_Op; typedef struct ompi_request_t *MPI_Request; typedef struct ompi_message_t *MPI_Message; typedef struct ompi_status_public_t MPI_Status; +typedef struct ompi_f08_status_public_t MPI_F08_status; typedef struct ompi_win_t *MPI_Win; typedef struct mca_base_var_enum_t *MPI_T_enum; typedef struct ompi_mpit_cvar_handle_t *MPI_T_cvar_handle; @@ -1779,7 +1780,11 @@ OMPI_DECLSPEC int MPI_Ssend(const void *buf, int count, MPI_Datatype datatype, OMPI_DECLSPEC int MPI_Start(MPI_Request *request); OMPI_DECLSPEC int MPI_Startall(int count, MPI_Request array_of_requests[]); OMPI_DECLSPEC int MPI_Status_c2f(const MPI_Status *c_status, MPI_Fint *f_status); +OMPI_DECLSPEC int MPI_Status_c2f08(const MPI_Status *c_status, MPI_F08_status *f08_status); +OMPI_DECLSPEC int MPI_Status_f082c(const MPI_F08_status *f08_status, MPI_Status *c_status); +OMPI_DECLSPEC int MPI_Status_f082f(const MPI_F08_status *f08_status, MPI_Fint *f_status); OMPI_DECLSPEC int MPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status); +OMPI_DECLSPEC int MPI_Status_f2f08(const MPI_Fint *f_status, MPI_F08_status *f08_status); OMPI_DECLSPEC int MPI_Status_set_cancelled(MPI_Status *status, int flag); OMPI_DECLSPEC int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count); @@ -2440,7 +2445,11 @@ OMPI_DECLSPEC int PMPI_Ssend(const void *buf, int count, MPI_Datatype datatype, OMPI_DECLSPEC int PMPI_Start(MPI_Request *request); OMPI_DECLSPEC int PMPI_Startall(int count, MPI_Request array_of_requests[]); OMPI_DECLSPEC int PMPI_Status_c2f(const MPI_Status *c_status, MPI_Fint *f_status); +OMPI_DECLSPEC int PMPI_Status_c2f08(const MPI_Status *c_status, MPI_F08_status *f08_status); +OMPI_DECLSPEC int PMPI_Status_f082f(const MPI_F08_status *f08_status, MPI_Fint *f_status); +OMPI_DECLSPEC int PMPI_Status_f082c(const MPI_F08_status *f08_status, MPI_Status *c_status); OMPI_DECLSPEC int PMPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status); +OMPI_DECLSPEC int PMPI_Status_f2f08(const MPI_Fint *f_status, MPI_F08_status *f08_status); OMPI_DECLSPEC int PMPI_Status_set_cancelled(MPI_Status *status, int flag); OMPI_DECLSPEC int PMPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count); diff --git a/ompi/mpi/c/Makefile.am b/ompi/mpi/c/Makefile.am index d4c822beba2..d58b564f225 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -15,8 +15,8 @@ # Copyright (c) 2012-2013 Inria. All rights reserved. # Copyright (c) 2013-2018 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -339,7 +339,11 @@ libmpi_c_mpi_la_SOURCES = \ start.c \ startall.c \ status_c2f.c \ + status_c2f08.c \ + status_f082c.c \ + status_f082f.c \ status_f2c.c \ + status_f2f08.c \ status_set_cancelled.c \ status_set_elements.c \ status_set_elements_x.c \ diff --git a/ompi/mpi/c/profile/Makefile.am b/ompi/mpi/c/profile/Makefile.am index 5330752db5c..a15613a6dd8 100644 --- a/ompi/mpi/c/profile/Makefile.am +++ b/ompi/mpi/c/profile/Makefile.am @@ -16,8 +16,8 @@ # Copyright (c) 2012-2013 Inria. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -319,6 +319,10 @@ nodist_libmpi_c_pmpi_la_SOURCES = \ pstart.c \ pstartall.c \ pstatus_c2f.c \ + pstatus_c2f08.c \ + pstatus_f082c.c \ + pstatus_f082f.c \ + pstatus_f2f08.c \ pstatus_f2c.c \ pstatus_set_cancelled.c \ pstatus_set_elements.c \ diff --git a/ompi/mpi/c/status_c2f.c b/ompi/mpi/c/status_c2f.c index 2b19e722092..68fc4f33f8c 100644 --- a/ompi/mpi/c/status_c2f.c +++ b/ompi/mpi/c/status_c2f.c @@ -95,8 +95,9 @@ int MPI_Status_c2f(const MPI_Status *c_status, MPI_Fint *f_status) 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++ ) + for( i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int)); i++ ) { f_status[i] = OMPI_INT_2_FINT(c_ints[i]); + } return MPI_SUCCESS; } diff --git a/ompi/mpi/c/status_c2f08.c b/ompi/mpi/c/status_c2f08.c new file mode 100644 index 00000000000..9475d1beeba --- /dev/null +++ b/ompi/mpi/c/status_c2f08.c @@ -0,0 +1,87 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" +#include + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" +#include "ompi/memchecker.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Status_c2f08 = PMPI_Status_c2f08 +#endif +#define MPI_Status_c2f08 PMPI_Status_c2f08 +#endif + +static const char FUNC_NAME[] = "MPI_Status_c2f08"; + + +int MPI_Status_c2f08(const MPI_Status *c_status, MPI_F08_status *f08_status) +{ + const int *c_ints; + MEMCHECKER( + if(c_status != MPI_STATUSES_IGNORE) { + /* + * Before checking the complete status, we need to reset the definedness + * of the MPI_ERROR-field (single-completion calls wait/test). + */ + opal_memchecker_base_mem_defined((void*)&c_status->MPI_ERROR, sizeof(int)); + memchecker_status(c_status); + } + ); + + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + + /* MPI-4:18.2.5 implies that if you pass in + MPI_STATUS[ES]_IGNORE, it's erroneous */ + + if (NULL == c_status || MPI_STATUS_IGNORE == c_status || + MPI_STATUSES_IGNORE == c_status || NULL == f08_status) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_IN_STATUS, FUNC_NAME); + } + } + + /* ***NOTE*** See huge comment in status_c2f.c (yes, I know + there's a size_t member in the C MPI_Status -- go + read that comment for an explanation why copying + everything as a bunch of int's is ok). */ + f08_status->MPI_SOURCE = OMPI_INT_2_FINT(c_status->MPI_SOURCE); + f08_status->MPI_TAG = OMPI_INT_2_FINT(c_status->MPI_TAG); + f08_status->MPI_ERROR = OMPI_INT_2_FINT(c_status->MPI_ERROR); + c_ints = (const int *)c_status + 3; + for(int i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int) - 3); i++ ) { + f08_status->internal[i] = OMPI_INT_2_FINT(c_ints[i]); + } + + return MPI_SUCCESS; +} diff --git a/ompi/mpi/c/status_f082c.c b/ompi/mpi/c/status_f082c.c new file mode 100644 index 00000000000..4c3deb24683 --- /dev/null +++ b/ompi/mpi/c/status_f082c.c @@ -0,0 +1,85 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Status_f082c = PMPI_Status_f082c +#endif +#define MPI_Status_f082c PMPI_Status_f082c +#endif + +static const char FUNC_NAME[] = "MPI_Status_f082c"; + + +int MPI_Status_f082c(const MPI_F08_status *f08_status, MPI_Status *c_status) +{ + int *c_ints; + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + + /* MPI-4:18.2.5 implies that if you pass in + MPI_STATUS[ES]_IGNORE, it's erroneous */ + + if (NULL == f08_status || +#if OMPI_BUILD_FORTRAN_BINDINGS + /* This section is #if'ed out if we are not building the + fortran bindings because these macros check values + against constants that only exist if the fortran + bindings exist. */ + OMPI_IS_FORTRAN_STATUS_IGNORE(f08_status) || + OMPI_IS_FORTRAN_STATUSES_IGNORE(f08_status) || +#endif + NULL == c_status) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_IN_STATUS, FUNC_NAME); + } + } + + /* ***NOTE*** See huge comment in status_c2f.c (yes, I know + there's a size_t member in the C MPI_Status -- go + read that comment for an explanation why copying + everything as a bunch of int's is ok). + + We can't use OMPI_FINT_2_INT here because of some complications + with include files. :-( So just do the casting manually. */ + c_status->MPI_SOURCE = (int)f08_status->MPI_SOURCE; + c_status->MPI_TAG = (int)f08_status->MPI_TAG; + c_status->MPI_ERROR = (int)f08_status->MPI_ERROR; + c_ints = (int *)c_status + 3; + for(int i=0; i < (int)(sizeof(MPI_Status) / sizeof(int) - 3); i++) { + c_ints[i] = (int)f08_status->internal[i]; + } + + return MPI_SUCCESS; +} diff --git a/ompi/mpi/c/status_f082f.c b/ompi/mpi/c/status_f082f.c new file mode 100644 index 00000000000..9a570842380 --- /dev/null +++ b/ompi/mpi/c/status_f082f.c @@ -0,0 +1,71 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Status_f082f = PMPI_Status_f082f +#endif +#define MPI_Status_f082f PMPI_Status_f082f +#endif + +static const char FUNC_NAME[] = "MPI_Status_f082f"; + + +int MPI_Status_f082f(const MPI_F08_status *f08_status, MPI_Fint *f_status) +{ + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + + /* MPI-2:4.12.5 says that if you pass in + MPI_STATUS[ES]_IGNORE, it's erroneous */ + + if (NULL == f08_status || +#if OMPI_BUILD_FORTRAN_BINDINGS + /* This section is #if'ed out if we are not building the + fortran bindings because these macros check values + against constants that only exist if the fortran + bindings exist. */ + OMPI_IS_FORTRAN_STATUS_IGNORE(f08_status) || + OMPI_IS_FORTRAN_STATUSES_IGNORE(f08_status) || +#endif + NULL == f_status) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_IN_STATUS, FUNC_NAME); + } + } + + memcpy(f_status, f08_status, OMPI_FORTRAN_STATUS_SIZE * sizeof(MPI_Fint)); + + return MPI_SUCCESS; +} diff --git a/ompi/mpi/c/status_f2c.c b/ompi/mpi/c/status_f2c.c index d00f4fcf220..338de7e4d48 100644 --- a/ompi/mpi/c/status_f2c.c +++ b/ompi/mpi/c/status_f2c.c @@ -75,8 +75,9 @@ int MPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status) 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++ ) + 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/mpi/c/status_f2f08.c b/ompi/mpi/c/status_f2f08.c new file mode 100644 index 00000000000..6f092a8204d --- /dev/null +++ b/ompi/mpi/c/status_f2f08.c @@ -0,0 +1,73 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" +#include + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" +#include "ompi/mpi/fortran/base/fint_2_int.h" +#include "ompi/mpi/fortran/base/constants.h" +#include "ompi/memchecker.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_Status_f2f08 = PMPI_Status_f2f08 +#endif +#define MPI_Status_f2f08 PMPI_Status_f2f08 +#endif + +static const char FUNC_NAME[] = "MPI_Status_f2f08"; + + +int MPI_Status_f2f08(const MPI_Fint *f_status, MPI_F08_status *f08_status) +{ + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + + /* MPI-2:4.12.5 says that if you pass in + MPI_STATUS[ES]_IGNORE, it's erroneous */ + + if (NULL == f_status || +#if OMPI_BUILD_FORTRAN_BINDINGS + /* This section is #if'ed out if we are not building the + fortran bindings because these macros check values + against constants that only exist if the fortran + bindings exist. */ + OMPI_IS_FORTRAN_STATUS_IGNORE(f_status) || + OMPI_IS_FORTRAN_STATUSES_IGNORE(f_status) || +#endif + NULL == f08_status) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_IN_STATUS, FUNC_NAME); + } + } + + memcpy(f08_status, f_status, OMPI_FORTRAN_STATUS_SIZE*sizeof(MPI_Fint)); + + return MPI_SUCCESS; +} diff --git a/ompi/mpi/fortran/configure-fortran-output.h.in b/ompi/mpi/fortran/configure-fortran-output.h.in index c44e965a07d..2c96d83a2b6 100644 --- a/ompi/mpi/fortran/configure-fortran-output.h.in +++ b/ompi/mpi/fortran/configure-fortran-output.h.in @@ -3,7 +3,7 @@ ! Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. -! Copyright (c) 2017-2019 Research Organization for Information Science +! Copyright (c) 2017-2020 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! ! $COPYRIGHT$ @@ -105,6 +105,8 @@ #define OMPI_ENABLE_MPI1_COMPAT @OMPI_ENABLE_MPI1_COMPAT@ +#define OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS @OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS@ + ! Include some post-processing, based on the values from above #include "ompi/mpi/fortran/configure-fortran-output-bottom.h" diff --git a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am index 23186eedb41..5e5312f6e2d 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am @@ -1,7 +1,7 @@ # # Copyright (c) 2012-2019 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2017-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ # @@ -28,6 +28,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08 \ -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) diff --git a/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am index 71bfad26d92..825da31f1a8 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am @@ -1,7 +1,7 @@ # # Copyright (c) 2012-2019 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ # @@ -28,6 +28,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-ignore-tkr \ -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) diff --git a/ompi/mpi/fortran/mpif-h/Makefile.am b/ompi/mpi/fortran/mpif-h/Makefile.am index 1b1f80d8527..b8225bf889d 100644 --- a/ompi/mpi/fortran/mpif-h/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/Makefile.am @@ -14,8 +14,8 @@ # Copyright (c) 2011-2013 Universite Bordeaux 1 # Copyright (c) 2013-2018 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ @@ -385,6 +385,8 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ ssend_init_f.c \ startall_f.c \ start_f.c \ + status_f082f_f.c \ + status_f2f08_f.c \ status_set_cancelled_f.c \ status_set_elements_f.c \ status_set_elements_x_f.c \ diff --git a/ompi/mpi/fortran/mpif-h/profile/Makefile.am b/ompi/mpi/fortran/mpif-h/profile/Makefile.am index 35a9390f6fb..9d183297df8 100644 --- a/ompi/mpi/fortran/mpif-h/profile/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/profile/Makefile.am @@ -15,8 +15,8 @@ # Copyright (c) 2011-2013 Universite Bordeaux 1 # Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ # @@ -298,6 +298,8 @@ linked_files = \ pssend_init_f.c \ pstartall_f.c \ pstart_f.c \ + pstatus_f082f_f.c \ + pstatus_f2f08_f.c \ pstatus_set_cancelled_f.c \ pstatus_set_elements_f.c \ pstatus_set_elements_x_f.c \ diff --git a/ompi/mpi/fortran/mpif-h/prototypes_mpi.h b/ompi/mpi/fortran/mpif-h/prototypes_mpi.h index 6a664e9bd2f..bd560a9dc26 100644 --- a/ompi/mpi/fortran/mpif-h/prototypes_mpi.h +++ b/ompi/mpi/fortran/mpif-h/prototypes_mpi.h @@ -14,8 +14,8 @@ * Copyright (c) 2011-2013 Universite Bordeaux 1 * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -354,6 +354,8 @@ PN2(void, MPI_Ssend_init, mpi_ssend_init, MPI_SSEND_INIT, (char *buf, MPI_Fint * PN2(void, MPI_Ssend, mpi_ssend, MPI_SSEND, (char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr)); PN2(void, MPI_Start, mpi_start, MPI_START, (MPI_Fint *request, MPI_Fint *ierr)); PN2(void, MPI_Startall, mpi_startall, MPI_STARTALL, (MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *ierr)); +PN2(void, MPI_Status_f082f, mpi_status_f082f, MPI_STATUS_F082F, (const MPI_F08_status *f08_status, MPI_Fint *f_status, MPI_Fint *ierr)); +PN2(void, MPI_Status_f2f08, mpi_status_f2f08, MPI_STATUS_F2F08, (const MPI_Fint *f_status, MPI_F08_status *f08_status, MPI_Fint *ierr)); PN2(void, MPI_Status_set_cancelled, mpi_status_set_cancelled, MPI_STATUS_SET_CANCELLED, (MPI_Fint *status, ompi_fortran_logical_t *flag, MPI_Fint *ierr)); PN2(void, MPI_Status_set_elements, mpi_status_set_elements, MPI_STATUS_SET_ELEMENTS, (MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr)); PN2(void, MPI_Status_set_elements_x, mpi_status_set_elements_x, MPI_STATUS_SET_ELEMENTS_X, (MPI_Fint *status, MPI_Fint *datatype, MPI_Count *count, MPI_Fint *ierr)); diff --git a/ompi/mpi/fortran/mpif-h/status_f082f_f.c b/ompi/mpi/fortran/mpif-h/status_f082f_f.c new file mode 100644 index 00000000000..83ac4d56727 --- /dev/null +++ b/ompi/mpi/fortran/mpif-h/status_f082f_f.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/fortran/mpif-h/bindings.h" +#include "ompi/mpi/fortran/base/constants.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak PMPI_STATUS_F082F = ompi_status_f082f_f +#pragma weak pmpi_status_f082f = ompi_status_f082f_f +#pragma weak pmpi_status_f082f_ = ompi_status_f082f_f +#pragma weak pmpi_status_f082f__ = ompi_status_f082f_f + +#pragma weak PMPI_Status_f082f_f = ompi_status_f082f_f +#pragma weak PMPI_Status_f082f_f08 = ompi_status_f082f_f +#else +OMPI_GENERATE_F77_BINDINGS(PMPI_STATUS_F082F, + pmpi_status_f082f, + pmpi_status_f082f_, + pmpi_status_f082f__, + pompi_status_f082f_f, + (const MPI_F08_status *f08_status, MPI_Fint *f_status, MPI_Fint *ierr), + (f08_status, f_status, ierr) ) +#endif +#endif + +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_STATUS_F082F = ompi_status_f082f_f +#pragma weak mpi_status_f082f = ompi_status_f082f_f +#pragma weak mpi_status_f082f_ = ompi_status_f082f_f +#pragma weak mpi_status_f082f__ = ompi_status_f082f_f + +#pragma weak MPI_Status_f082f_f = ompi_status_f082f_f +#pragma weak MPI_Status_f082f_f08 = ompi_status_f082f_f +#else +#if ! OMPI_BUILD_MPI_PROFILING +OMPI_GENERATE_F77_BINDINGS(MPI_STATUS_F082F, + mpi_status_f082f, + mpi_status_f082f_, + mpi_status_f082f__, + ompi_status_f082f_f, + (const MPI_F08_status *f08_status, MPI_Fint *f_status, MPI_Fint *ierr), + (f08_status, f_status, ierr) ) +#else +#define ompi_status_f082f_f pompi_status_f082f_f +#endif +#endif + + +void ompi_status_f082f_f(const MPI_F08_status *f08_status, MPI_Fint *f_status, MPI_Fint *ierr) +{ + int c_ierr; + + c_ierr = PMPI_Status_f082f(f08_status, f_status); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); +} diff --git a/ompi/mpi/fortran/mpif-h/status_f2f08_f.c b/ompi/mpi/fortran/mpif-h/status_f2f08_f.c new file mode 100644 index 00000000000..02b6db7a34f --- /dev/null +++ b/ompi/mpi/fortran/mpif-h/status_f2f08_f.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/fortran/mpif-h/bindings.h" +#include "ompi/mpi/fortran/base/constants.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak PMPI_STATUS_F2F08 = ompi_status_f2f08_f +#pragma weak pmpi_status_f2f08 = ompi_status_f2f08_f +#pragma weak pmpi_status_f2f08_ = ompi_status_f2f08_f +#pragma weak pmpi_status_f2f08__ = ompi_status_f2f08_f + +#pragma weak PMPI_Status_f2f08_f = ompi_status_f2f08_f +#pragma weak PMPI_Status_f2f08_f08 = ompi_status_f2f08_f +#else +OMPI_GENERATE_F77_BINDINGS(PMPI_STATUS_F2F08, + pmpi_status_f2f08, + pmpi_status_f2f08_, + pmpi_status_f2f08__, + pompi_status_f2f08_f, + (const MPI_Fint *f_status, MPI_F08_status *f08_status, MPI_Fint *ierr), + (f_status, f08_status, ierr) ) +#endif +#endif + +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_STATUS_F2F08 = ompi_status_f2f08_f +#pragma weak mpi_status_f2f08 = ompi_status_f2f08_f +#pragma weak mpi_status_f2f08_ = ompi_status_f2f08_f +#pragma weak mpi_status_f2f08__ = ompi_status_f2f08_f + +#pragma weak MPI_Status_f2f08_f = ompi_status_f2f08_f +#pragma weak MPI_Status_f2f08_f08 = ompi_status_f2f08_f +#else +#if ! OMPI_BUILD_MPI_PROFILING +OMPI_GENERATE_F77_BINDINGS(MPI_STATUS_F2F08, + mpi_status_f2f08, + mpi_status_f2f08_, + mpi_status_f2f08__, + ompi_status_f2f08_f, + (const MPI_Fint *f_stttttatus, MPI_F08_status *f08_status *f08_status, MPI_Fint *ierr), + (f_status, f08_status, ierr) ) +#else +#define ompi_status_f2f08_f pompi_status_f2f08_f +#endif +#endif + + +void ompi_status_f2f08_f(const MPI_Fint *f_status, MPI_F08_status *f08_status, MPI_Fint *ierr) +{ + int c_ierr; + + c_ierr = PMPI_Status_f2f08(f_status, f08_status); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); +} diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/Makefile.am index 2ed9a01997f..3ab8c24f50e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/Makefile.am @@ -7,7 +7,7 @@ # Copyright (c) 2012-2013 Inria. All rights reserved. # Copyright (c) 2013-2018 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2019 Research Organization for Information Science +# Copyright (c) 2015-2020 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved. @@ -36,6 +36,7 @@ if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS AM_FCFLAGS = -I$(top_builddir)/ompi/include \ -I$(top_srcdir)/ompi/include \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG)mod \ $(OMPI_FC_MODULE_FLAG)bindings \ @@ -363,6 +364,8 @@ mpi_api_files = \ ssend_init_f08.F90 \ startall_f08.F90 \ start_f08.F90 \ + status_f082f_f08.F90 \ + status_f2f08_f08.F90 \ status_set_cancelled_f08.F90 \ status_set_elements_f08.F90 \ status_set_elements_x_f08.F90 \ @@ -718,6 +721,8 @@ pmpi_api_files = \ profile/pssend_init_f08.F90 \ profile/pstartall_f08.F90 \ profile/pstart_f08.F90 \ + profile/pstatus_f082f_f08.F90 \ + profile/pstatus_f2f08_f08.F90 \ profile/pstatus_set_cancelled_f08.F90 \ profile/pstatus_set_elements_f08.F90 \ profile/pstatus_set_elements_x_f08.F90 \ diff --git a/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am index 7e1bc3bc299..7b62c571a4a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am @@ -1,6 +1,8 @@ # -*- makefile -*- # -# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # # $COPYRIGHT$ # diff --git a/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am index b00d08757ca..9e038f7e87f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am @@ -7,8 +7,8 @@ # Copyright (c) 2012-2013 Inria. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # # $COPYRIGHT$ @@ -33,6 +33,7 @@ if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS AM_FCFLAGS = -I$(top_builddir)/ompi/include \ -I$(top_srcdir)/ompi/include \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG). \ $(OMPI_FC_MODULE_FLAG)../mod \ diff --git a/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h b/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h index 32437112347..140ad0d01f2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h +++ b/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h @@ -7,7 +7,7 @@ ! of Tennessee Research Foundation. All rights ! reserved. ! Copyright (c) 2012 Inria. All rights reserved. -! Copyright (c) 2015-2019 Research Organization for Information Science +! Copyright (c) 2015-2020 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ ! @@ -2635,6 +2635,24 @@ subroutine ompi_query_thread_f(provided,ierror) & INTEGER, INTENT(OUT) :: ierror end subroutine ompi_query_thread_f +subroutine ompi_status_f082f_f(f08_status,f_status,ierror) & + BIND(C, name="ompi_status_f2f08_f") + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, INTENT(OUT) :: ierror +end subroutine ompi_status_f082f_f + +subroutine ompi_status_f2f08_f(f_status,f08_status,ierror) & + BIND(C, name="ompi_status_f082f_f") + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, INTENT(OUT) :: ierror +end subroutine ompi_status_f2f08_f + subroutine ompi_status_set_elements_f(status,datatype,count,ierror) & BIND(C, name="ompi_status_set_elements_f") use :: mpi_f08_types, only : MPI_Status diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am index ae85a4a7ea7..52639bf101a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am @@ -7,7 +7,7 @@ # Copyright (c) 2012-2013 Inria. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2015-2019 Research Organization for Information Science +# Copyright (c) 2015-2020 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # @@ -33,6 +33,7 @@ if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS AM_FCFLAGS = -I$(top_builddir)/ompi/include \ -I$(top_srcdir)/ompi/include \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG). \ -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) @@ -53,6 +54,9 @@ libusempif08_internal_modules_la_SOURCES = \ mpi-f08-callbacks.F90 \ mpi-f08-constants.h +libusempif08_internal_modules_la_LIBADD = \ + $(top_builddir)/ompi/mpi/fortran/use-mpi/libusempi_internal_modules.la + libforce_usempif08_internal_modules_to_be_built_la_SOURCES = \ mpi-f08-interfaces.F90 \ pmpi-f08-interfaces.F90 \ diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90 b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90 index 55ae341d800..46100f46d5a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90 @@ -7,8 +7,8 @@ ! of Tennessee Research Foundation. All rights ! reserved. ! Copyright (c) 2012 Inria. All rights reserved. -! Copyright (c) 2015-2017 Research Organization for Information Science -! and Technology (RIST). All rights reserved. +! Copyright (c) 2015-2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ ! @@ -3498,6 +3498,26 @@ subroutine MPI_Query_thread_f08(provided,ierror) end subroutine MPI_Query_thread_f08 end interface MPI_Query_thread +interface MPI_Status_f082f +subroutine MPI_Status_f082f_f08(f08_status,f_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +end subroutine MPI_Status_f082f_f08 +end interface MPI_Status_f082f + +interface MPI_Status_f2f08 +subroutine MPI_Status_f2f08_f08(f_status,f08_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +end subroutine MPI_Status_f2f08_f08 +end interface MPI_Status_f2f08 + interface MPI_Status_set_cancelled subroutine MPI_Status_set_cancelled_f08(status,flag,ierror) use :: mpi_f08_types, only : MPI_Status diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 index a383f3bcf75..c1abace16b3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 @@ -3,7 +3,7 @@ ! Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. -! Copyright (c) 2015-2019 Research Organization for Information Science +! Copyright (c) 2015-2020 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! Copyright (c) 2020 The University of Tennessee and The University @@ -21,6 +21,7 @@ module mpi_f08_types use, intrinsic :: ISO_C_BINDING + use mpi_types include "mpif-config.h" include "mpif-constants.h" @@ -70,24 +71,6 @@ module mpi_f08_types integer :: MPI_VAL end type MPI_Win - type, BIND(C) :: MPI_Status - integer :: MPI_SOURCE - integer :: MPI_TAG - integer :: MPI_ERROR - ! The mpif.h interface uses MPI_STATUS_SIZE to know how long of - ! an array of INTEGERs is necessary to hold a C MPI_Status. - ! Effectively do the same thing here: pad out this datatype with - ! as many INTEGERs as there are C int's can fit in - ! sizeof(MPI_Status) bytes -- see MPI_Status_ctof() for an - ! explanation why. - ! - ! This padding makes this F08 Type(MPI_Status) be the same size - ! as the mpif.h status (i.e., an array of MPI_STATUS_SIZE - ! INTEGERs), which is critical for MPI_Status_ctof() to not - ! overwrite memory. - integer OMPI_PRIVATE :: internal(MPI_STATUS_SIZE - 3) - end type MPI_Status - ! ! Pre-defined handles ! diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90 b/ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90 index 6e02e8aac2c..95ebf8fe5b1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90 @@ -7,8 +7,8 @@ ! of Tennessee Research Foundation. All rights ! reserved. ! Copyright (c) 2012 Inria. All rights reserved. -! Copyright (c) 2015-2017 Research Organization for Information Science -! and Technology (RIST). All rights reserved. +! Copyright (c) 2015-2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ ! @@ -3498,6 +3498,26 @@ subroutine PMPI_Query_thread_f08(provided,ierror) end subroutine PMPI_Query_thread_f08 end interface PMPI_Query_thread +interface PMPI_Status_f082f +subroutine PMPI_Status_f082f_f08(f08_status,f_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +end subroutine PMPI_Status_f082f_f08 +end interface PMPI_Status_f082f + +interface PMPI_Status_f2f08 +subroutine PMPI_Status_f2f08_f08(f_status,f08_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +end subroutine PMPI_Status_f2f08_f08 +end interface PMPI_Status_f2f08 + interface PMPI_Status_set_cancelled subroutine PMPI_Status_set_cancelled_f08(status,flag,ierror) use :: mpi_f08_types, only : MPI_Status diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f082f_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f082f_f08.F90 new file mode 100644 index 00000000000..8c31cc73b1b --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f082f_f08.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ + +subroutine PMPI_Status_f082f_f08(f08_status,f_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + use :: ompi_mpifh_bindings, only : ompi_status_f082f_f + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + integer :: c_ierror + + call ompi_status_f082f_f(f08_status, f_status, c_ierror) + if (present(ierror)) ierror = c_ierror + +end subroutine PMPI_Status_f082f_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f2f08_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f2f08_f08.F90 new file mode 100644 index 00000000000..5052c999b38 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_f2f08_f08.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ + +subroutine PMPI_Status_f2f08_f08(f_status,f08_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + use :: ompi_mpifh_bindings, only : ompi_status_f2f08_f + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + integer :: c_ierror + + call ompi_status_f2f08_f(f_status, f08_status, c_ierror) + if (present(ierror)) ierror = c_ierror + +end subroutine PMPI_Status_f2f08_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/status_f082f_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/status_f082f_f08.F90 new file mode 100644 index 00000000000..e24519c3216 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/status_f082f_f08.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ + +subroutine MPI_Status_f082f_f08(f08_status,f_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + use :: ompi_mpifh_bindings, only : ompi_status_f082f_f + implicit none + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + integer :: c_ierror + + call ompi_status_f082f_f(f08_status, f_status, c_ierror) + if (present(ierror)) ierror = c_ierror + +end subroutine MPI_Status_f082f_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/status_f2f08_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/status_f2f08_f08.F90 new file mode 100644 index 00000000000..1375d77204b --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/status_f2f08_f08.F90 @@ -0,0 +1,19 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ + +subroutine MPI_Status_f2f08_f08(f_status,f08_status,ierror) + use :: mpi_f08_types, only : MPI_Status, MPI_STATUS_SIZE + use :: ompi_mpifh_bindings, only : ompi_status_f2f08_f + implicit none + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + integer :: c_ierror + + call ompi_status_f2f08_f(f_status, f08_status, c_ierror) + if (present(ierror)) ierror = c_ierror + +end subroutine MPI_Status_f2f08_f08 diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am index 481cf800472..2a5ac9270e7 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am @@ -1,8 +1,8 @@ # -*- makefile -*- # # Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. @@ -27,6 +27,7 @@ AM_CPPFLAGS = if OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ + -I$(top_builddir)/ompi/mpi/fortran/use-mpi \ -I$(top_builddir) -I$(top_srcdir) $(FCFLAGS_f90) lib_LTLIBRARIES = lib@OMPI_LIBMPI_NAME@_usempi_ignore_tkr.la @@ -38,6 +39,7 @@ mpi-ignore-tkr-removed-interfaces.h: mpi-ignore-tkr-removed-interfaces.h.in mpi-ignore-tkr.lo: $(top_srcdir)/ompi/mpi/fortran/base/attr-fn-int-callback-interfaces.h mpi-ignore-tkr.lo: $(top_srcdir)/ompi/mpi/fortran/base/conversion-fn-null-int-interface.h mpi-ignore-tkr.lo: mpi-ignore-tkr-interfaces.h +mpi-ignore-tkr.lo: mpi-ignore-tkr-status.h mpi-ignore-tkr.lo: mpi-ignore-tkr-file-interfaces.h mpi-ignore-tkr.lo: mpi-ignore-tkr-removed-interfaces.h mpi-ignore-tkr.lo: mpi-ignore-tkr-sizeof.h @@ -45,7 +47,9 @@ mpi-ignore-tkr.lo: mpi-ignore-tkr-sizeof.f90 mpi-ignore-tkr.lo: mpi-ignore-tkr.F90 lib@OMPI_LIBMPI_NAME@_usempi_ignore_tkr_la_SOURCES = \ - mpi-ignore-tkr.F90 + mpi-ignore-tkr.F90 \ + mpi-ignore-tkr-status.h + nodist_lib@OMPI_LIBMPI_NAME@_usempi_ignore_tkr_la_SOURCES = \ mpi-ignore-tkr-interfaces.h \ mpi-ignore-tkr-file-interfaces.h \ @@ -58,11 +62,17 @@ nodist_lib@OMPI_LIBMPI_NAME@_usempi_ignore_tkr_la_SOURCES += \ mpi-ignore-tkr-sizeof.f90 endif +libusempi_internal_modules = +if OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS +libusempi_internal_modules += $(top_builddir)/ompi/mpi/fortran/use-mpi/libusempi_internal_modules.la +endif + # Note that we invoke some OPAL functions directly in # libmpi_usempi_ignore_tkr.la, so we need to link in the OPAL library # directly (pulling it in indirectly via libmpi.la does not work on # all platforms). lib@OMPI_LIBMPI_NAME@_usempi_ignore_tkr_la_LIBADD = \ + $(libusempi_internal_modules) \ $(OMPI_TOP_BUILDDIR)/opal/lib@OPAL_LIB_PREFIX@open-pal.la lib@OMPI_LIBMPI_NAME@_usempi_ignore_tkr_la_LDFLAGS = \ -version-info $(libmpi_usempi_ignore_tkr_so_version) \ diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h b/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h new file mode 100644 index 00000000000..bd5635700fe --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h @@ -0,0 +1,61 @@ +! -*- fortran -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ + + +interface MPI_Status_f082f + +subroutine MPI_Status_f082f(f08_status, f_status, ierror) + use mpi_types + include 'mpif-config.h' + type(MPI_Status), intent(in) :: f08_status + integer, intent(out) :: f_status(MPI_STATUS_SIZE) + integer, intent(out) :: ierror +end subroutine MPI_Status_f082f + +end interface + + +interface MPI_Status_f2f08 + +subroutine MPI_Status_f2f08(f_status, f08_status, ierror) + use mpi_types + include 'mpif-config.h' + integer, intent(in) :: f_status(MPI_STATUS_SIZE) + type(MPI_Status), intent(out) :: f08_status + integer, intent(out) :: ierror +end subroutine MPI_Status_f2f08 + +end interface + + +interface PMPI_Status_f082f + +subroutine PMPI_Status_f082f(f08_status, f_status, ierror) + use mpi_types + include 'mpif-config.h' + type(MPI_Status), intent(in) :: f08_status + integer, intent(out) :: f_status(MPI_STATUS_SIZE) + integer, intent(out) :: ierror +end subroutine PMPI_Status_f082f + +end interface + + +interface PMPI_Status_f2f08 + +subroutine PMPI_Status_f2f08(f_status, f08_status, ierror) + use mpi_types + include 'mpif-config.h' + integer, intent(in) :: f_status(MPI_STATUS_SIZE) + type(MPI_Status), intent(out) :: f08_status + integer, intent(out) :: ierror +end subroutine PMPI_Status_f2f08 + +end interface diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr.F90 b/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr.F90 index e19c4280a93..1f31468ce47 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr.F90 +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr.F90 @@ -11,8 +11,8 @@ ! Copyright (c) 2004-2005 The Regents of the University of California. ! All rights reserved. ! Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. -! Copyright (c) 2017 Research Organization for Information Science -! and Technology (RIST). All rights reserved. +! Copyright (c) 2017-2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ ! ! Additional copyrights may follow @@ -24,6 +24,9 @@ module mpi +#if OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS + use mpi_types +#endif include "mpif-config.h" include "mpif-constants.h" include "mpif-handles.h" @@ -42,6 +45,9 @@ module mpi ! The ignore-TKR version of the MPI interfaces include "ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-interfaces.h" +#if OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS + include "ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-status.h" +#endif include "ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h" #if !defined(OMPI_ENABLE_MPI1_COMPAT) diff --git a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am index 8ffd719dbb9..ce5c8a295d0 100644 --- a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am @@ -13,8 +13,8 @@ # Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2007 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2014-2016 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2014-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ @@ -49,6 +49,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ $(OMPI_FC_MODULE_FLAG). -I$(top_srcdir) -I$(top_builddir) -I. \ + -I$(top_builddir)/ompi/mpi/fortran/use-mpi \ -I$(top_builddir)/ompi/mpi/fortran/use-mpi-tkr $(FCFLAGS_f90) # Do different things if the top-level configure decided that we're @@ -66,11 +67,13 @@ lib_LTLIBRARIES += lib@OMPI_LIBMPI_NAME@_usempi.la mpi.lo: mpi.F90 mpi.lo: mpi-f90-interfaces.h +mpi.lo: mpi-f90-status.h mpi.lo: mpi-f90-file-interfaces.h mpi.lo: mpi-f90-removed-interfaces.h mpi.lo: $(top_builddir)/ompi/mpi/fortran/configure-fortran-output.h mpi.lo: mpi-f90-cptr-interfaces.h mpi.lo: pmpi-f90-interfaces.h +mpi.lo: pmpi-f90-status.h mpi.lo: pmpi-f90-file-interfaces.h mpi.lo: pmpi-f90-removed-interfaces.h mpi.lo: pmpi-f90-cptr-interfaces.h @@ -102,12 +105,18 @@ nodist_lib@OMPI_LIBMPI_NAME@_usempi_la_SOURCES += \ endif mpi.lo: $(nodist_lib@OMPI_LIBMPI_NAME@_usempi_la_SOURCES) +libusempi_internal_modules = +if OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS +libusempi_internal_modules += $(top_builddir)/ompi/mpi/fortran/use-mpi/libusempi_internal_modules.la +endif + # Note that we invoke some OPAL functions directly in # libmpi_usempi.la, so we need to link in the OPAL library directly # (pulling it in indirectly via libmpi.la does not work on all # platforms). lib@OMPI_LIBMPI_NAME@_usempi_la_LIBADD = \ $(top_builddir)/ompi/mpi/fortran/mpif-h/lib@OMPI_LIBMPI_NAME@_mpifh.la \ + $(libusempi_internal_modules) \ $(OMPI_TOP_BUILDDIR)/opal/lib@OPAL_LIB_PREFIX@open-pal.la # Set the library version lib@OMPI_LIBMPI_NAME@_usempi_la_LDFLAGS = \ @@ -181,10 +190,12 @@ endif EXTRA_DIST = \ mpi-f90-interfaces.h \ + mpi-f90-status.h \ mpi-f90-file-interfaces.h \ mpi-f90-removed-interfaces.h \ mpi-f90-cptr-interfaces.h \ pmpi-f90-interfaces.h \ + pmpi-f90-status.h \ pmpi-f90-file-interfaces.h \ pmpi-f90-removed-interfaces.h \ pmpi-f90-cptr-interfaces.h diff --git a/ompi/mpi/fortran/use-mpi-tkr/mpi-f90-status.h b/ompi/mpi/fortran/use-mpi-tkr/mpi-f90-status.h new file mode 100644 index 00000000000..1f75bb46d31 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-tkr/mpi-f90-status.h @@ -0,0 +1,35 @@ +! -*- fortran -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ + + +interface MPI_Status_f082f + +subroutine MPI_Status_f082f(f08_status, f_status, ierror) + use mpi_types + include 'mpif-config.h' + type(MPI_Status), intent(in) :: f08_status + integer, intent(out) :: f_status(MPI_STATUS_SIZE) + integer, intent(out) :: ierror +end subroutine MPI_Status_f082f + +end interface + + +interface MPI_Status_f2f08 + +subroutine MPI_Status_f2f08(f_status, f08_status, ierror) + use mpi_types + include 'mpif-config.h' + integer, intent(in) :: f_status(MPI_STATUS_SIZE) + type(MPI_Status), intent(out) :: f08_status + integer, intent(out) :: ierror +end subroutine MPI_Status_f2f08 + +end interface diff --git a/ompi/mpi/fortran/use-mpi-tkr/mpi.F90 b/ompi/mpi/fortran/use-mpi-tkr/mpi.F90 index bb6a4ce651a..69ee51262ba 100644 --- a/ompi/mpi/fortran/use-mpi-tkr/mpi.F90 +++ b/ompi/mpi/fortran/use-mpi-tkr/mpi.F90 @@ -11,7 +11,7 @@ ! Copyright (c) 2004-2005 The Regents of the University of California. ! All rights reserved. ! Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. -! Copyright (c) 2016-2019 Research Organization for Information Science +! Copyright (c) 2016-2020 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ ! @@ -24,6 +24,10 @@ module mpi +#if OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS + use mpi_types +#endif + include "mpif-config.h" include "mpif-constants.h" include "mpif-handles.h" @@ -46,6 +50,11 @@ module mpi #include "mpi-f90-cptr-interfaces.h" #include "pmpi-f90-cptr-interfaces.h" +#if OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS + include "mpi-f90-status.h" + include "pmpi-f90-status.h" +#endif + ! This file is generated, and is *huge*. Its size is directly related ! to the --with-f90-max-array-dim configure parameter. diff --git a/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-status.h b/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-status.h new file mode 100644 index 00000000000..d20bd24829e --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-status.h @@ -0,0 +1,35 @@ +! -*- fortran -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ + + +interface PMPI_Status_f082f + +subroutine PMPI_Status_f082f(f08_status, f_status, ierror) + use mpi_types + include 'mpif-config.h' + type(MPI_Status), intent(in) :: f08_status + integer, intent(out) :: f_status(MPI_STATUS_SIZE) + integer, intent(out) :: ierror +end subroutine PMPI_Status_f082f + +end interface + + +interface PMPI_Status_f2f08 + +subroutine PMPI_Status_f2f08(f_status, f08_status, ierror) + use mpi_types + include 'mpif-config.h' + integer, intent(in) :: f_status(MPI_STATUS_SIZE) + type(MPI_Status), intent(out) :: f08_status + integer, intent(out) :: ierror +end subroutine PMPI_Status_f2f08 + +end interface diff --git a/ompi/mpi/fortran/use-mpi/Makefile.am b/ompi/mpi/fortran/use-mpi/Makefile.am new file mode 100644 index 00000000000..3f1bc6b1760 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi/Makefile.am @@ -0,0 +1,67 @@ +# -*- makefile -*- +# +# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2012-2013 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2012-2013 Inria. All rights reserved. +# Copyright (c) 2013 Los Alamos National Security, LLC. All rights +# reserved. +# Copyright (c) 2015-2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2016 IBM Corporation. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +include $(top_srcdir)/Makefile.ompi-rules + +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + +# This Makefile is only relevant if we support TYPE(MPI_Status) +# MPI bindings. +if OMPI_FORTRAN_HAVE_TYPE_MPI_STATUS + +AM_FCFLAGS = -I$(top_builddir)/ompi/include \ + -I$(top_srcdir)/ompi/include \ + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) + +MOSTLYCLEANFILES = *.mod + +CLEANFILES += *.i90 + +########################################################################### + + +noinst_LTLIBRARIES = libusempi_internal_modules.la + +# Don't distribute mpi-types.F90, it is generated. +nodist_libusempi_internal_modules_la_SOURCES = \ + mpi-types.F90 + +mpi-types.lo: mpi-types.F90 + +# Install the generated .mod files. Unfortunately, each F90 compiler +# may generate different filenames, so we have to use a glob. :-( + +install-exec-hook: + @ for file in `ls *.mod`; do \ + echo $(INSTALL) $$file $(DESTDIR)$(libdir); \ + $(INSTALL) $$file $(DESTDIR)$(libdir); \ + done + +uninstall-local: + @ for file in `ls *.mod`; do \ + echo rm -f $(DESTDIR)$(libdir)/$$file; \ + rm -f $(DESTDIR)$(libdir)/$$file; \ + done +endif diff --git a/ompi/mpi/fortran/use-mpi/mpi-types.F90.in b/ompi/mpi/fortran/use-mpi/mpi-types.F90.in new file mode 100644 index 00000000000..3b2ac85e2e8 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi/mpi-types.F90.in @@ -0,0 +1,39 @@ +! -*- f90 -*- +! +! Copyright (c) 2020 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ +! + +! PRIVATE or not +#if @OMPI_FORTRAN_HAVE_PRIVATE@ +#define OMPI_PRIVATE , PRIVATE +#else +#define OMPI_PRIVATE +#endif + +module mpi_types + +type, BIND(C) :: MPI_Status + integer :: MPI_SOURCE + integer :: MPI_TAG + integer :: MPI_ERROR + ! The mpif.h interface uses MPI_STATUS_SIZE to know how long of + ! an array of INTEGERs is necessary to hold a C MPI_Status. + ! Effectively do the same thing here: pad out this datatype with + ! as many INTEGERs as there are C int's can fit in + ! sizeof(MPI_Status) bytes -- see MPI_Status_ctof() for an + ! explanation why. + ! + ! This padding makes this F08 Type(MPI_Status) be the same size + ! as the mpif.h status (i.e., an array of MPI_STATUS_SIZE + ! INTEGERs), which is critical for MPI_Status_ctof() to not + ! overwrite memory. + integer OMPI_PRIVATE :: internal(@OMPI_FORTRAN_STATUS_SIZE@ - 3) + end type MPI_Status + +end module diff --git a/ompi/mpi/man/man3/MPI_Status_c2f08.3in b/ompi/mpi/man/man3/MPI_Status_c2f08.3in new file mode 100644 index 00000000000..b3c411bb42c --- /dev/null +++ b/ompi/mpi/man/man3/MPI_Status_c2f08.3in @@ -0,0 +1 @@ +.so man3/MPI_Status_f082c.3 diff --git a/ompi/mpi/man/man3/MPI_Status_f082c.3in b/ompi/mpi/man/man3/MPI_Status_f082c.3in new file mode 100644 index 00000000000..e33b5e38ad7 --- /dev/null +++ b/ompi/mpi/man/man3/MPI_Status_f082c.3in @@ -0,0 +1,30 @@ +.\" -*- nroff -*- +.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved. +.\" Copyright 2006-2008 Sun Microsystems, Inc. +.\" Copyright (c) 1996 Thinking Machines Corporation +.\" Copyright (c) 2020 Research Organization for Information Science +.\" and Technology (RIST). All rights reserved. +.\" $COPYRIGHT$ +.TH MPI_Status_f082c 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" +.SH NAME +\fBMPI_Status_f082c, MPI_Status_c2f08 \fP \- Translates a C status into a Fortran 2008 status, or vice versa. + +.SH SYNTAX +.ft R +.SH C Syntax +.nf +#include +int MPI_Status_f082c(const MPI_F08_status \fI*f08_status\fP, MPI_Status \fI*c_status\fP) +int MPI_Status_c2f08(const MPI_Status \fI*c_status\fP, MPI_F08_status \fI*f08_status\fP) + +.fi +.SH DESCRIPTION +.ft R +These two procedures are provided in C to convert from a Fortran 2008 status (which is a derived type made of integers) to a C status (which is a structure), and vice versa. The conversion occurs on all the information in \fIstatus\fP, including that which is hidden. That is, no status information is lost in the conversion. +.sp +When using MPI_Status_f082c, if \fIf08_status\fP is a valid Fortran status, but not the Fortran value of MPI_F08_STATUS_IGNORE or MPI_F08_STATUSES_IGNORE, then MPI_Status_f082c returns in \fIc_status\fP a valid C status with the same content. If \fIf08_status\fP is the Fortran value of MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIf08_status\fP is not a valid Fortran status, then the call is erroneous. +.sp +When using MPI_Status_c2f08, the opposite conversion is applied. If \fIc_status\fP is MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIc_status\fP is not a valid C status, then the call is erroneous. +.sp +The C status has the same source, tag and error code values as the Fortran status, and returns the same answers when queried for count, elements, and cancellation. The conversion function may be called with a Fortran status argument that has an undefined error field, in which case the value of the error field in the C status argument is undefined. +.sp diff --git a/ompi/mpi/man/man3/MPI_Status_f082f.3in b/ompi/mpi/man/man3/MPI_Status_f082f.3in new file mode 100644 index 00000000000..fe975dbaa0a --- /dev/null +++ b/ompi/mpi/man/man3/MPI_Status_f082f.3in @@ -0,0 +1,56 @@ +.\" -*- nroff -*- +.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved. +.\" Copyright 2006-2008 Sun Microsystems, Inc. +.\" Copyright (c) 1996 Thinking Machines Corporation +.\" Copyright (c) 2020 Research Organization for Information Science +.\" and Technology (RIST). All rights reserved. +.\" $COPYRIGHT$ +.TH MPI_Status_f082f 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" +.SH NAME +\fBMPI_Status_f082f, MPI_Status_f2f08 \fP \- Translates a Fortran status into a Fortran 2008 status, or vice versa. + +.SH SYNTAX +.ft R +.SH C Syntax +.nf +#include +int MPI_Status_f082c(const MPI_F08_status \fI*f08_status\fP, MPI_Status \fI*c_status\fP) +int MPI_Status_c2f08(const MPI_Status \fI*c_status\fP, MPI_F08_status \fI*f08_status\fP) + +.fi +.SH Fortran Syntax +.nf +USE MPI +MPI_STATUS_F082F(\fF08_STATUS, F_STATUS, IERROR) + TYPE(MPI_STATUS), INTENT(IN) :: \fIF08_STATUS\fP + INTEGER \fISTATUS_MPI_STATUS_SIZE), IERROR\fP + +MPI_STATUS_F2F08(\fF_STATUS, F08_STATUS, IERROR) + INTEGER \fISTATUS_MPI_STATUS_SIZE), IERROR\fP + TYPE(MPI_STATUS), INTENT(OUT) :: \fIF08_STATUS\fP + +.fi +.SH Fortran 2008 Syntax +.nf +USE mpi_f08 +MPI_Status_f082f(\fIf08_status\fP, \fIf_status\fP, \fIierror\fP) + TYPE(MPI_Status), INTENT(IN) :: \fIf08_status\fP + INTEGER \fISTATUS(MPI_STATUS_SIZE)\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPI_Status_f2f08(\fIf_status\fP, \fIf08_status\fP, \fIierror\fP) + INTEGER \fISTATUS(MPI_STATUS_SIZE)\fP + TYPE(MPI_Status), INTENT(OUT) :: \fIf08_status\fP + +.fi +.SH DESCRIPTION +.ft R +These two procedures are provided to convert from a Fortran 2008 status (which is a derived datatype made of integers) to a Fortran status (which is an array of integers), and vice versa. The conversion occurs on all the information in \fIstatus\fP, including that which is hidden. That is, no status information is lost in the conversion. +These subroutines are not provided with the old \fIinclude 'mpif.h'\fP Fortran bindings. +.sp +When using MPI_Status_f082f, if \fIf08_status\fP is a valid Fortran status, but not the Fortran value of MPI_F08_STATUS_IGNORE (in C), MPI_STATUS_IGNORE (in Fortran) or MPI_F08_STATUSES_IGNORE (in C) or MPI_STATUSES_IGNORE (in Fortran), then MPI_Status_f082f returns in \fIf_status\fP a valid array with the same content. If \fIf08_status\fP is the C value of MPI_F08_STATUS_IGNORE or MPI_F08_STATUSES_IGNORE or the Fortran value of MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIf08_status\fP is not a valid Fortran status, then the call is erroneous. +.sp +When using MPI_Status_f2f08, the opposite conversion is applied. If \fIf_status\fP is MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIf_status\fP is not a valid Fortran status, then the call is erroneo$us. +.sp +The Fortran status has the same source, tag and error code values as the Fortran 2008 status, and returns the same answers when queried for count, elements, and cancellation. The conversion function may be called with a Fortran status argument that has an undefined error field, in which case the value of the error field in the Fortran status argument is undefined. +.sp diff --git a/ompi/mpi/man/man3/MPI_Status_f2f08.3in b/ompi/mpi/man/man3/MPI_Status_f2f08.3in new file mode 100644 index 00000000000..67f77ae23bc --- /dev/null +++ b/ompi/mpi/man/man3/MPI_Status_f2f08.3in @@ -0,0 +1 @@ +.so man3/MPI_Status_f082f.3 diff --git a/ompi/mpi/man/man3/Makefile.am b/ompi/mpi/man/man3/Makefile.am index 8e3e63390b0..0a4a655bc0f 100644 --- a/ompi/mpi/man/man3/Makefile.am +++ b/ompi/mpi/man/man3/Makefile.am @@ -2,6 +2,8 @@ # Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights reserved. +# Copyright (c) 2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -311,8 +313,12 @@ TEMPLATE_FILES = \ MPI_Ssend_init.3in \ MPI_Start.3in \ MPI_Startall.3in \ + MPI_Status_c2f08.3in \ MPI_Status_c2f.3in \ + MPI_Status_f082c.3in \ + MPI_Status_f082f.3in \ MPI_Status_f2c.3in \ + MPI_Status_f2f08.3in \ MPI_Status_set_cancelled.3in \ MPI_Status_set_elements.3in \ MPI_Status_set_elements_x.3in \ diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am b/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am index 8f3157f8197..b03a78e610f 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am +++ b/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am @@ -1,6 +1,6 @@ # # Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017-2019 Research Organization for Information Science +# Copyright (c) 2017-2020 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ @@ -22,7 +22,8 @@ AM_CPPFLAGS = # We must set these #defines and include paths so that the inner OMPI # MPI prototype header files do the Right Thing. -AM_FCFLAGS = $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ +AM_FCFLAGS = $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi \ + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ -I$(top_builddir) -I$(top_srcdir) $(FCFLAGS_f90) # Note that the mpi_f08-based bindings are optional -- they can only From c04dc355de4d706912bd5bdec887c7ceb2d99888 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 8 Sep 2020 07:43:54 -0700 Subject: [PATCH 24/31] mpi/man: convert MPI_Status conversion man pages to Markdown Convert the MPI_Status_f082f, MPI_Status_f082c, and MPI_Status_f2c man pages to Markdown. Fix some typos and improve the text a bit along the way. Left the raw NROFF redirect pages MPI_Status_f2f08, MPI_Status_c2f08, and MPI_Status_c2f files as they were -- they're 1-line redirects, and it seems simpler to leave those (vs. duplicating the Markdown). Signed-off-by: Jeff Squyres --- ompi/mpi/man/man3/MPI_Status_f082c.3.md | 58 ++++++++++++++++ ompi/mpi/man/man3/MPI_Status_f082c.3in | 30 -------- ompi/mpi/man/man3/MPI_Status_f082f.3.md | 92 +++++++++++++++++++++++++ ompi/mpi/man/man3/MPI_Status_f082f.3in | 56 --------------- ompi/mpi/man/man3/MPI_Status_f2c.3.md | 57 +++++++++++++++ ompi/mpi/man/man3/MPI_Status_f2c.3in | 30 -------- ompi/mpi/man/man3/Makefile.am | 8 +-- 7 files changed, 211 insertions(+), 120 deletions(-) create mode 100644 ompi/mpi/man/man3/MPI_Status_f082c.3.md delete mode 100644 ompi/mpi/man/man3/MPI_Status_f082c.3in create mode 100644 ompi/mpi/man/man3/MPI_Status_f082f.3.md delete mode 100644 ompi/mpi/man/man3/MPI_Status_f082f.3in create mode 100644 ompi/mpi/man/man3/MPI_Status_f2c.3.md delete mode 100644 ompi/mpi/man/man3/MPI_Status_f2c.3in diff --git a/ompi/mpi/man/man3/MPI_Status_f082c.3.md b/ompi/mpi/man/man3/MPI_Status_f082c.3.md new file mode 100644 index 00000000000..c9004565f7e --- /dev/null +++ b/ompi/mpi/man/man3/MPI_Status_f082c.3.md @@ -0,0 +1,58 @@ +# NAME + +MPI_Status_f082c, MPI_Status_c2f08 - Translates a C status into a Fortran 2008 status, or vice versa. + +# SYNTAX + +## C Syntax + +```c +#include + +int MPI_Status_f082c(const MPI_F08_status *f08_status, MPI_Status *c_status) +int MPI_Status_c2f08(const MPI_Status *c_status, MPI_F08_status *f08_status) +``` + +# PARAMETERS + +* `f08_status`: `mpi_f08`-style MPI status object +* `c_status`: C-style MPI status object + +# DESCRIPTION + +These two procedures are provided in C to convert from a Fortran 2008 +status (which is a derived type made of integers) to a C status (which +is a structure), and vice versa. The conversion occurs on all the +information in `status`, including that which is hidden. That is, +no status information is lost in the conversion. + +When using `MPI_Status_f082c()`, if `f08_status` is a valid Fortran +status, but not the Fortran value of `MPI_F08_STATUS_IGNORE` or +`MPI_F08_STATUSES_IGNORE`, then `MPI_Status_f082c()` returns in +`c_status` a valid C status with the same content. If `f08_status` is +the Fortran value of `MPI_STATUS_IGNORE` or `MPI_STATUSES_IGNORE`, or +if `f08_status` is not a valid Fortran status, then the call is +erroneous. + +When using `MPI_Status_c2f08()`, the opposite conversion is applied. If +`c_status` is `MPI_STATUS_IGNORE` or `MPI_STATUSES_IGNORE`, or if +`c_status` is not a valid C status, then the call is erroneous. + +The input status has the same source, tag and error code values as the +output status, and returns the same answers when queried for count, +elements, and cancellation. The conversion function may be called with +an input status argument that has an undefined error field, in which +case the value of the error field in the output status argument is +undefined. + +# NOTES + +These functions are only available in C; they are not available in any +of the Fortran MPI interfaces. + +# SEE ALSO + +[`MPI_Status_c2f`(3)](MPI_Status_c2f.html), +[`MPI_Status_f2c`(3)](MPI_Status_f2c.html), +[`MPI_Status_f082f`(3)](MPI_Status_f082f.html), +[`MPI_Status_f2f08`(3)](MPI_Status_f2f08.html) diff --git a/ompi/mpi/man/man3/MPI_Status_f082c.3in b/ompi/mpi/man/man3/MPI_Status_f082c.3in deleted file mode 100644 index e33b5e38ad7..00000000000 --- a/ompi/mpi/man/man3/MPI_Status_f082c.3in +++ /dev/null @@ -1,30 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved. -.\" Copyright 2006-2008 Sun Microsystems, Inc. -.\" Copyright (c) 1996 Thinking Machines Corporation -.\" Copyright (c) 2020 Research Organization for Information Science -.\" and Technology (RIST). All rights reserved. -.\" $COPYRIGHT$ -.TH MPI_Status_f082c 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" -.SH NAME -\fBMPI_Status_f082c, MPI_Status_c2f08 \fP \- Translates a C status into a Fortran 2008 status, or vice versa. - -.SH SYNTAX -.ft R -.SH C Syntax -.nf -#include -int MPI_Status_f082c(const MPI_F08_status \fI*f08_status\fP, MPI_Status \fI*c_status\fP) -int MPI_Status_c2f08(const MPI_Status \fI*c_status\fP, MPI_F08_status \fI*f08_status\fP) - -.fi -.SH DESCRIPTION -.ft R -These two procedures are provided in C to convert from a Fortran 2008 status (which is a derived type made of integers) to a C status (which is a structure), and vice versa. The conversion occurs on all the information in \fIstatus\fP, including that which is hidden. That is, no status information is lost in the conversion. -.sp -When using MPI_Status_f082c, if \fIf08_status\fP is a valid Fortran status, but not the Fortran value of MPI_F08_STATUS_IGNORE or MPI_F08_STATUSES_IGNORE, then MPI_Status_f082c returns in \fIc_status\fP a valid C status with the same content. If \fIf08_status\fP is the Fortran value of MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIf08_status\fP is not a valid Fortran status, then the call is erroneous. -.sp -When using MPI_Status_c2f08, the opposite conversion is applied. If \fIc_status\fP is MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIc_status\fP is not a valid C status, then the call is erroneous. -.sp -The C status has the same source, tag and error code values as the Fortran status, and returns the same answers when queried for count, elements, and cancellation. The conversion function may be called with a Fortran status argument that has an undefined error field, in which case the value of the error field in the C status argument is undefined. -.sp diff --git a/ompi/mpi/man/man3/MPI_Status_f082f.3.md b/ompi/mpi/man/man3/MPI_Status_f082f.3.md new file mode 100644 index 00000000000..a53af76bef8 --- /dev/null +++ b/ompi/mpi/man/man3/MPI_Status_f082f.3.md @@ -0,0 +1,92 @@ +# NAME + +MPI_Status_f082f, MPI_Status_c2f08 - Translates a Fortran 2008 status into a Fortran INTEGER-style status, or vice versa. + +# SYNTAX + +## C Syntax + +```c +#include + +int MPI_Status_f082f(const MPI_F08_status *f08_status, MPI_Fint *f_status) +int MPI_Status_f2f08(const MPI_Fint *f_status, MPI_F08_status *f08_status) +``` + +## Fortran mpi Module Syntax + +```fortran +USE MPI + +MPI_STATUS_F082F(F08_STATUS, F_STATUS, IERROR) + TYPE(MPI_Status) :: F08_STATUS + INTEGER :: STATUS(MPI_STATUS_SIZE), IERROR + +MPI_STATUS_F2F08(F_STATUS, F08_STATUS, IERROR) + INTEGER :: F_STATUS(MPI_STATUS_SIZE), IERROR + TYPE(MPI_Status) :: F08_STATUS +``` + +## Fortran mpi_f08 Module Syntax + +```fortran +USE mpi_f08 + +MPI_Status_f082f(f08_status, f_status, ierror) + TYPE(MPI_Status), INTENT(IN) :: f08_status + INTEGER, INTENT(OUT) :: f_status(MPI_STATUS_SIZE) + INTEGER, OPTIONAL, INTENT(OUT) :: ierror + +MPI_Status_f2f08(f_status, f08_status, ierror) + INTEGER, INTENT(IN) :: f_status(MPI_STATUS_SIZE) + TYPE(MPI_Status), INTENT(OUT) :: f08_status + INTEGER, OPTIONAL, INTENT(OUT) :: ierror +``` + +# PARAMETERS + +* `f08_status`: `mpi_f08`-style MPI status object +* `f_status`: `mpi`-style `INTEGER` MPI status object + +# DESCRIPTION + +These two procedures are provided to convert from a Fortran 2008 +status (which is a derived datatype made of integers) to a Fortran +status (which is an array of integers), and vice versa. The conversion +occurs on all the information in `status`, including that which is +hidden. That is, no status information is lost in the conversion. + +When using `MPI_Status_f082f()`, if `f08_status` is a valid Fortran +status, but not the Fortran value of `MPI_F08_STATUS_IGNORE` (in C), +`MPI_STATUS_IGNORE` (in Fortran) or `MPI_F08_STATUSES_IGNORE` (in C) +or `MPI_STATUSES_IGNORE` (in Fortran), then `MPI_Status_f082f()` +returns in `f_status` a valid array with the same content. If +`f08_status` is the C value of `MPI_F08_STATUS_IGNORE` or +`MPI_F08_STATUSES_IGNORE` or the Fortran value of `MPI_STATUS_IGNORE` +or `MPI_STATUSES_IGNORE`, or if `f08_status` is not a valid Fortran +status, then the call is erroneous. + +When using `MPI_Status_f2f08()`, the opposite conversion is +applied. If `f_status` is `MPI_STATUS_IGNORE` or +`MPI_STATUSES_IGNORE`, or if `f_status` is not a valid Fortran status, +then the call is erroneous. + +The input status has the same source, tag and error code values as the +output status, and returns the same answers when queried for count, +elements, and cancellation. The conversion function may be called with +an input status argument that has an undefined error field, in which +case the value of the error field in the output status argument is +undefined. + +# NOTES + +The Fortran subroutines for these MPI routines are only available in +the `mpi` and `mpi_f08` modules (including the type specification for +`TYPE(MPI_Status); they are (intentionally) not available in `mpif.h`. + +# SEE ALSO + +[`MPI_Status_c2f`(3)](MPI_Status_c2f.html), +[`MPI_Status_f2c`(3)](MPI_Status_c2f.html), +[`MPI_Status_f082c`(3)](MPI_Status_f082c.html), +[`MPI_Status_c2f08`(3)](MPI_Status_c2f08.html) diff --git a/ompi/mpi/man/man3/MPI_Status_f082f.3in b/ompi/mpi/man/man3/MPI_Status_f082f.3in deleted file mode 100644 index fe975dbaa0a..00000000000 --- a/ompi/mpi/man/man3/MPI_Status_f082f.3in +++ /dev/null @@ -1,56 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved. -.\" Copyright 2006-2008 Sun Microsystems, Inc. -.\" Copyright (c) 1996 Thinking Machines Corporation -.\" Copyright (c) 2020 Research Organization for Information Science -.\" and Technology (RIST). All rights reserved. -.\" $COPYRIGHT$ -.TH MPI_Status_f082f 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" -.SH NAME -\fBMPI_Status_f082f, MPI_Status_f2f08 \fP \- Translates a Fortran status into a Fortran 2008 status, or vice versa. - -.SH SYNTAX -.ft R -.SH C Syntax -.nf -#include -int MPI_Status_f082c(const MPI_F08_status \fI*f08_status\fP, MPI_Status \fI*c_status\fP) -int MPI_Status_c2f08(const MPI_Status \fI*c_status\fP, MPI_F08_status \fI*f08_status\fP) - -.fi -.SH Fortran Syntax -.nf -USE MPI -MPI_STATUS_F082F(\fF08_STATUS, F_STATUS, IERROR) - TYPE(MPI_STATUS), INTENT(IN) :: \fIF08_STATUS\fP - INTEGER \fISTATUS_MPI_STATUS_SIZE), IERROR\fP - -MPI_STATUS_F2F08(\fF_STATUS, F08_STATUS, IERROR) - INTEGER \fISTATUS_MPI_STATUS_SIZE), IERROR\fP - TYPE(MPI_STATUS), INTENT(OUT) :: \fIF08_STATUS\fP - -.fi -.SH Fortran 2008 Syntax -.nf -USE mpi_f08 -MPI_Status_f082f(\fIf08_status\fP, \fIf_status\fP, \fIierror\fP) - TYPE(MPI_Status), INTENT(IN) :: \fIf08_status\fP - INTEGER \fISTATUS(MPI_STATUS_SIZE)\fP - INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP - -MPI_Status_f2f08(\fIf_status\fP, \fIf08_status\fP, \fIierror\fP) - INTEGER \fISTATUS(MPI_STATUS_SIZE)\fP - TYPE(MPI_Status), INTENT(OUT) :: \fIf08_status\fP - -.fi -.SH DESCRIPTION -.ft R -These two procedures are provided to convert from a Fortran 2008 status (which is a derived datatype made of integers) to a Fortran status (which is an array of integers), and vice versa. The conversion occurs on all the information in \fIstatus\fP, including that which is hidden. That is, no status information is lost in the conversion. -These subroutines are not provided with the old \fIinclude 'mpif.h'\fP Fortran bindings. -.sp -When using MPI_Status_f082f, if \fIf08_status\fP is a valid Fortran status, but not the Fortran value of MPI_F08_STATUS_IGNORE (in C), MPI_STATUS_IGNORE (in Fortran) or MPI_F08_STATUSES_IGNORE (in C) or MPI_STATUSES_IGNORE (in Fortran), then MPI_Status_f082f returns in \fIf_status\fP a valid array with the same content. If \fIf08_status\fP is the C value of MPI_F08_STATUS_IGNORE or MPI_F08_STATUSES_IGNORE or the Fortran value of MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIf08_status\fP is not a valid Fortran status, then the call is erroneous. -.sp -When using MPI_Status_f2f08, the opposite conversion is applied. If \fIf_status\fP is MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIf_status\fP is not a valid Fortran status, then the call is erroneo$us. -.sp -The Fortran status has the same source, tag and error code values as the Fortran 2008 status, and returns the same answers when queried for count, elements, and cancellation. The conversion function may be called with a Fortran status argument that has an undefined error field, in which case the value of the error field in the Fortran status argument is undefined. -.sp diff --git a/ompi/mpi/man/man3/MPI_Status_f2c.3.md b/ompi/mpi/man/man3/MPI_Status_f2c.3.md new file mode 100644 index 00000000000..4f24ffdc938 --- /dev/null +++ b/ompi/mpi/man/man3/MPI_Status_f2c.3.md @@ -0,0 +1,57 @@ +# NAME + +MPI_Status_f2c, MPI_Status_f2c - Translates a C status into a Fortran INTEGER-style status, or vice versa. + +# SYNTAX + +## C Syntax + +```c +#include + +int MPI_Status_f2c(const MPI_Fint *f_status, MPI_Status *c_status) +int MPI_Status_c2f(const MPI_Status *c_status, MPI_Fint *f_status) +``` + +# PARAMETERS + +* `f_status`: `mpi`-style `INTEGER` MPI status object +* `c_status`: C-style MPI status object + +# DESCRIPTION + +These two procedures are provided in C to convert from a Fortran +status (which is an array of integers) to a C status (which is a +structure), and vice versa. The conversion occurs on all the +information in `status`, including that which is hidden. That is, +no status information is lost in the conversion. + +When using `MPI_Status_f2c()`, if `f_status` is a valid Fortran +status, but not the Fortran value of `MPI_STATUS_IGNORE` or +`MPI_STATUSES_IGNORE`, then `MPI_Status_f2c()` returns in `c_status` a +valid C status with the same content. If `f_status` is the Fortran +value of `MPI_STATUS_IGNORE` or `MPI_STATUSES_IGNORE`, or if +`f_status` is not a valid Fortran status, then the call is erroneous. + +When using `MPI_Status_c2f()`, the opposite conversion is applied. If +`c_status` is `MPI_STATUS_IGNORE` or `MPI_STATUSES_IGNORE`, or if +`c_status` is not a valid C status, then the call is erroneous. + +The input status has the same source, tag and error code values as the +output status, and returns the same answers when queried for count, +elements, and cancellation. The conversion function may be called with +an input status argument that has an undefined error field, in which +case the value of the error field in the output status argument is +undefined. + +# NOTES + +These functions are only available in C; they are not available in any +of the Fortran MPI interfaces. + +# SEE ALSO + +[`MPI_Status_f082c`(3)](MPI_Status_f082c.html), +[`MPI_Status_c2f08`(3)](MPI_Status_c2f08.html), +[`MPI_Status_f082f`(3)](MPI_Status_f082f.html), +[`MPI_Status_f2f08`(3)](MPI_Status_f2f08.html) diff --git a/ompi/mpi/man/man3/MPI_Status_f2c.3in b/ompi/mpi/man/man3/MPI_Status_f2c.3in deleted file mode 100644 index c28748be543..00000000000 --- a/ompi/mpi/man/man3/MPI_Status_f2c.3in +++ /dev/null @@ -1,30 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved. -.\" Copyright 2006-2008 Sun Microsystems, Inc. -.\" Copyright (c) 1996 Thinking Machines Corporation -.\" $COPYRIGHT$ -.TH MPI_Status_f2c 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" -.SH NAME -\fBMPI_Status_f2c, MPI_Status_c2f \fP \- Translates a C status into a Fortran status, or vice versa. - -.SH SYNTAX -.ft R -.SH C Syntax -.nf -#include -int MPI_Status_f2c(const MPI_Fint \fI*f_status\fP, MPI_Status \fI*c_status\fP) -int MPI_Status_c2f(const MPI_Status \fI*c_status\fP, MPI_Fint \fI*f_status\fP) - -.fi -.SH DESCRIPTION -.ft R -These two procedures are provided in C to convert from a Fortran status (which is an array of integers) to a C status (which is a structure), and vice versa. The conversion occurs on all the information in \fIstatus\fP, including that which is hidden. That is, no status information is lost in the conversion. -.sp -When using MPI_Status_f2c, if \fIf_status\fP is a valid Fortran status, but not the Fortran value of MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, then MPI_Status_f2c returns in \fIc_status\fP a valid C status with the same content. If \fIf_status\fP is the Fortran value of MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIf_status\fP is not a valid Fortran status, then the call is erroneous. -.sp -When using MPI_Status_c2f, the opposite conversion is applied. If \fIc_status\fP is MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE, or if \fIc_status\fP is not a valid C status, then the call is erroneous. -.sp -The C status has the same source, tag and error code values as the Fortran status, and returns the same answers when queried for count, elements, and cancellation. The conversion function may be called with a Fortran status argument that has an undefined error field, in which case the value of the error field in the C status argument is undefined. -.sp - - diff --git a/ompi/mpi/man/man3/Makefile.am b/ompi/mpi/man/man3/Makefile.am index 0a4a655bc0f..f44459f4fb0 100644 --- a/ompi/mpi/man/man3/Makefile.am +++ b/ompi/mpi/man/man3/Makefile.am @@ -24,7 +24,10 @@ include $(top_srcdir)/Makefile.ompi-rules # https://rmarkdown.rstudio.com/authoring_pandoc_markdown.html MD_FILES = \ - MPI_T_init_thread.3.md + MPI_T_init_thread.3.md \ + MPI_Status_f2c.3.md \ + MPI_Status_f082c.3.md \ + MPI_Status_f082f.3.md TEMPLATE_FILES = \ MPI_Abort.3in \ @@ -315,9 +318,6 @@ TEMPLATE_FILES = \ MPI_Startall.3in \ MPI_Status_c2f08.3in \ MPI_Status_c2f.3in \ - MPI_Status_f082c.3in \ - MPI_Status_f082f.3in \ - MPI_Status_f2c.3in \ MPI_Status_f2f08.3in \ MPI_Status_set_cancelled.3in \ MPI_Status_set_elements.3in \ From 49da998f33ec77500db0d90f77d33090dae7f6cb Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Sun, 13 Sep 2020 22:56:58 -0400 Subject: [PATCH 25/31] Fix a copy/paste in the RDMA emulation. Signed-off-by: George Bosilca --- opal/mca/btl/sm/btl_sm_sc_emu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/sm/btl_sm_sc_emu.c b/opal/mca/btl/sm/btl_sm_sc_emu.c index 2840bd09d0d..3c143dbeacc 100644 --- a/opal/mca/btl/sm/btl_sm_sc_emu.c +++ b/opal/mca/btl/sm/btl_sm_sc_emu.c @@ -90,7 +90,7 @@ static void mca_btl_sm_sc_emu_atomic_32 (int32_t *operand, opal_atomic_int32_t * } #endif -static void mca_btl_sm_sc_emu_rdma (mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *desc, void *ctx) +static void mca_btl_sm_sc_emu_rdma (mca_btl_base_module_t *btl, const mca_btl_base_receive_descriptor_t *desc) { mca_btl_sm_sc_emu_hdr_t *hdr = (mca_btl_sm_sc_emu_hdr_t *) desc->des_segments[0].seg_addr.pval; size_t size = desc->des_segments[0].seg_len - sizeof (*hdr); From fb8bfccb83df30559b1719d0295bf357e6e45042 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 14 Sep 2020 09:19:47 +0900 Subject: [PATCH 26/31] mpif-h: fix a typo in MPI_Status_f2f08() Signed-off-by: Gilles Gouaillardet --- ompi/mpi/fortran/mpif-h/status_f2f08_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mpi/fortran/mpif-h/status_f2f08_f.c b/ompi/mpi/fortran/mpif-h/status_f2f08_f.c index 02b6db7a34f..dee468f994e 100644 --- a/ompi/mpi/fortran/mpif-h/status_f2f08_f.c +++ b/ompi/mpi/fortran/mpif-h/status_f2f08_f.c @@ -48,7 +48,7 @@ OMPI_GENERATE_F77_BINDINGS(MPI_STATUS_F2F08, mpi_status_f2f08_, mpi_status_f2f08__, ompi_status_f2f08_f, - (const MPI_Fint *f_stttttatus, MPI_F08_status *f08_status *f08_status, MPI_Fint *ierr), + (const MPI_Fint *f_status, MPI_F08_status *f08_status, MPI_Fint *ierr), (f_status, f08_status, ierr) ) #else #define ompi_status_f2f08_f pompi_status_f2f08_f From 8384bc3acec0763694c44292cddc64db484ea520 Mon Sep 17 00:00:00 2001 From: "Vallee, Geoffroy R" Date: Tue, 28 Aug 2018 17:27:28 -0400 Subject: [PATCH 27/31] First complete implementation of the SICM support --- opal/mca/mpool/sicm/Makefile.am | 39 +++ opal/mca/mpool/sicm/configure.m4 | 52 ++++ opal/mca/mpool/sicm/mpool_sicm.h | 68 +++++ opal/mca/mpool/sicm/mpool_sicm_component.c | 274 +++++++++++++++++++++ opal/mca/mpool/sicm/mpool_sicm_module.c | 125 ++++++++++ 5 files changed, 558 insertions(+) create mode 100644 opal/mca/mpool/sicm/Makefile.am create mode 100644 opal/mca/mpool/sicm/configure.m4 create mode 100644 opal/mca/mpool/sicm/mpool_sicm.h create mode 100644 opal/mca/mpool/sicm/mpool_sicm_component.c create mode 100644 opal/mca/mpool/sicm/mpool_sicm_module.c diff --git a/opal/mca/mpool/sicm/Makefile.am b/opal/mca/mpool/sicm/Makefile.am new file mode 100644 index 00000000000..69c6371df02 --- /dev/null +++ b/opal/mca/mpool/sicm/Makefile.am @@ -0,0 +1,39 @@ +# -*- indent-tabs-mode:nil -*- +# +# Copyright (c) 2018 UT-Battelle, LLC +# All rights reserved. +# +# Additional copyrights may follow +# +# $HEADERS$ +# + + +AM_CPPFLAGS = $(mpool_sicm_CPPFLAGS) +AM_LDFLAGS = $(mpool_sicm_LDFLAGS) + +if MCA_BUILD_opal_mpool_sicm_DSO +component_noinst = +component_install = mca_mpool_sicm.la +else +component_noinst = libmca_mpool_sicm.la +component_install = +endif + +sicm_SOURCES = mpool_sicm.h \ + mpool_sicm_component.c \ + mpool_sicm_module.c + +mcacomponentdir = $(opallibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_mpool_sicm_la_SOURCES = $(sicm_SOURCES) +nodist_mca_mpool_sicm_la_SOURCES = $(sicm_nodist_SOURCES) +mca_mpool_sicm_la_LIBASS = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ + $(mpool_sicm_LIBS) +mca_mpool_sicm_la_LDFLAGS = -module -avoid-version $(mpool_sicm_LDFLAGS) + +noinst_LTLIBRARIES = $(component_noinst) +libmca_mpool_sicm_la_SOURCES = $(sicm_SOURCES) +nodist_libmca_mpool_sicm_la_SOURCES = $(sicm_nodist_SOURCES) +libmca_mpool_sicm_la_LIBADD = $(mpool_sicm_LIBS) +libmca_mpool_sicm_la_LDFLAGS = -module -avoid-version $(mpool_sicm_LDFLAGS) diff --git a/opal/mca/mpool/sicm/configure.m4 b/opal/mca/mpool/sicm/configure.m4 new file mode 100644 index 00000000000..83691e5a9a6 --- /dev/null +++ b/opal/mca/mpool/sicm/configure.m4 @@ -0,0 +1,52 @@ +# -*- shell-script -*- +# +# Copyright (c) 2018 UT-Battelle, LLC +# All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# check if SICM support can be found. +AC_DEFUN([MCA_opal_mpool_sicm_CONFIG], + [OPAL_VAR_SCOPE_PUSH([opal_mpool_sicm_happy]) + AC_CONFIG_FILES([opal/mca/mpool/sicm/Makefile]) + + _sicm_cppflags="" + _sicm_ldflags="" + _sicm_libs="" + + AC_ARG_WITH([sicm], + [AC_HELP_STRING([--with-sicm(=DIR)], + [Build with Simple Interface Complex Memory library support]) + ] + ) + OPAL_CHECK_WITHDIR([sicm], [$with_sicm], [include/sicm_low.h]) + + AS_IF([test "$with_sicm" != "no"], + [# At the moment, we always assume that users will use their own installation of SICM + + AS_IF([test ! -d "$with_sicm"], + [AC_MSG_RESULT([not found]) + AC_MSG_WARN([Directory $with_sicm not found]) + AC_MSG_ERROR([Cannot continue]) + ], + [AC_MSG_RESULT([found]) + _sicm_cppflags="-I$with_sicm/include" + _sicm_ldflags="-L$with_sicm/lib" + _sicm_libs="-lsicm" + opal_mpool_sicm_happy="yes" + ] + ) + + ],[opal_mpool_sicm_happy=no] + ) + + AC_SUBST([mpool_sicm_CPPFLAGS],"$_sicm_cppflags") + AC_SUBST([mpool_sicm_LDFLAGS],"$_sicm_ldflags -lsicm") + AC_SUBST([mpool_sicm_LIBS],"$_sicm_libs") + OPAL_VAR_SCOPE_POP + ] +) diff --git a/opal/mca/mpool/sicm/mpool_sicm.h b/opal/mca/mpool/sicm/mpool_sicm.h new file mode 100644 index 00000000000..fcc80f5fa62 --- /dev/null +++ b/opal/mca/mpool/sicm/mpool_sicm.h @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2018 UT-Battelle, LLC + * All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADERS$ + */ + +#ifndef MCA_MPOOL_SICM_H +#define MCA_MPOOL_SICM_H + +#include "opal_config.h" +#include "opal/threads/mutex_unix.h" + +#include "opal/mca/event/event.h" +#include "opal/mca/mpool/mpool.h" + +#include "sicm_low.h" + +BEGIN_C_DECLS + +struct mca_mpool_sicm_module_t { + mca_mpool_base_module_t super; + bool sicm_is_initialized; + sicm_device_tag target_device_type; + opal_mutex_t lock; +}; +typedef struct mca_mpool_sicm_module_t mca_mpool_sicm_module_t; + +#if 0 +struct mca_mpool_sicm_module_le_t { + opal_list_item_t super; + mca_mpool_sicm_module_t module; +}; +typedef struct mca_mpool_sicm_module_le_t mca_mpool_sicm_module_le_t; +OBJ_CLASS_DECLARATION(mca_mpool_sicm_module_le_t); +#endif + +struct mca_mpool_sicm_component_t { + mca_mpool_base_component_t super; + int module_count; + mca_mpool_sicm_module_t **modules; + int priority; + int output; + sicm_device_list devices; +}; +typedef struct mca_mpool_sicm_component_t mca_mpool_sicm_component_t; +OPAL_MODULE_DECLSPEC extern mca_mpool_sicm_component_t mca_mpool_sicm_component; + +int mpool_sicm_module_init (mca_mpool_sicm_module_t *module); + +void mpool_sicm_finalize (mca_mpool_base_module_t *module); + +#if 0 +static void* mpool_sicm_alloc (mca_mpool_base_module_t *module, size_t size, size_t align, uint32_t flags); + +static void* mpool_sicm_realloc (mca_mpool_base_module_t *module, void *addr, size_t size); + +static void mpool_sicm_free (mca_mpool_base_module_t *module, void *addr); +#endif + +END_C_DECLS + +#endif /* MCA_MPOOL_SICM_H */ diff --git a/opal/mca/mpool/sicm/mpool_sicm_component.c b/opal/mca/mpool/sicm/mpool_sicm_component.c new file mode 100644 index 00000000000..db136f34178 --- /dev/null +++ b/opal/mca/mpool/sicm/mpool_sicm_component.c @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2018 UT-Battelle, LLC + * All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADERS$ + */ + +#include "opal/mca/mpool/mpool.h" +#include "opal/mca/mpool/sicm/mpool_sicm.h" + +static int mpool_sicm_priority; +static int mpool_sicm_verbose; + +extern mca_mpool_sicm_module_t mca_mpool_sicm_module; + +static int mpool_sicm_register (void); +static int mpool_sicm_open (void); +static int mpool_sicm_close (void); +static int mpool_sicm_query (const char *hints, int *priority, mca_mpool_base_module_t **module); + +mca_mpool_sicm_component_t mca_mpool_sicm_component = { + { + .mpool_version = { + MCA_MPOOL_BASE_VERSION_3_0_0, + "sicm", + MCA_BASE_MAKE_VERSION ( + component, + OPAL_MAJOR_VERSION, + OPAL_MINOR_VERSION, + OPAL_RELEASE_VERSION), + .mca_open_component = mpool_sicm_open, + .mca_close_component = mpool_sicm_close, + .mca_register_component_params = mpool_sicm_register + }, + .mpool_data = { + MCA_BASE_METADATA_PARAM_CHECKPOINT + }, + .mpool_query = mpool_sicm_query, + }, + .modules = NULL, + .module_count = 0, +}; + + +static int +mpool_sicm_register (void) +{ + mpool_sicm_priority = 0; + mpool_sicm_verbose = 0; + +#if 0 + mca_base_component_var_register (&mpool_sicm_component.super.mpool_version, + "default_type", + "Default sicm type to use", + MCA_BASE_VAR_TYPE_INT, + mpool_sicm_type_enum, + 0, + 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_LOCAL + &mpool_sicm_component.default_type); +#endif + + mca_base_component_var_register (&mca_mpool_sicm_component.super.mpool_version, + "priority", + "Default priority of the SICM mpool component (default: 0)", + MCA_BASE_VAR_TYPE_INT, + NULL, + 0, + 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_LOCAL, + &mpool_sicm_priority); + + mca_base_component_var_register (&mca_mpool_sicm_component.super.mpool_version, + "verbose", + "Default level of verbosity for the SICM mpool component (default: 0)", + MCA_BASE_VAR_TYPE_INT, + NULL, + 0, + 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_LOCAL, + &mpool_sicm_verbose); + + return OPAL_SUCCESS; +} + +static int +_mpool_sicm_extend_module_list (void) +{ + int n_mods = mca_mpool_sicm_component.module_count + 1; + mca_mpool_sicm_module_t *_new_mod = NULL; + + if (n_mods == 1) + { + mca_mpool_sicm_component.modules = (mca_mpool_sicm_module_t**) malloc (sizeof (mca_mpool_sicm_module_t*)); + } + else + { + mca_mpool_sicm_component.modules = (mca_mpool_sicm_module_t**) realloc (mca_mpool_sicm_component.modules, n_mods * sizeof (mca_mpool_sicm_module_t*)); + } + + if (mca_mpool_sicm_component.modules == NULL) + return OPAL_ERR_OUT_OF_RESOURCE; + + _new_mod = (mca_mpool_sicm_module_t*) malloc (sizeof (mca_mpool_sicm_module_t)); + if (_new_mod == NULL) + return OPAL_ERR_OUT_OF_RESOURCE; + + mpool_sicm_module_init (_new_mod); + mca_mpool_sicm_component.modules[mca_mpool_sicm_component.module_count] = _new_mod; + + mca_mpool_sicm_component.module_count = n_mods; + + return OPAL_SUCCESS; +} + +static int +mpool_sicm_open (void) +{ + if (mpool_sicm_verbose != 0) + { + mca_mpool_sicm_component.output = opal_output_open (NULL); + } + else + { + mca_mpool_sicm_component.output = -1; + } + + // In case we can allocate memory based on various parameters, + // we will instantiate a SICM module for each configuration + // For now, we create one default module. + _mpool_sicm_extend_module_list (); + + return OPAL_SUCCESS; +} + +static int +mpool_sicm_close (void) +{ + for (int _i = 0; _i < mca_mpool_sicm_component.module_count; _i++) + { + mca_mpool_sicm_module_t *_m = mca_mpool_sicm_component.modules[_i]; + _m->super.mpool_finalize (&_m->super); + } + + free (mca_mpool_sicm_component.modules); + mca_mpool_sicm_component.modules = NULL; + + return OPAL_SUCCESS; +} + +static void +_parse_hints (const char *hints, int *priority, mca_mpool_base_module_t **module) +{ + int _priority = 0; + sicm_device_tag device_type = SICM_DRAM; + + if (hints) + { + char **_hints; + int _i = 0; + + // _hints is NULL terminated + _hints = opal_argv_split (hints, ','); + if (_hints == NULL) + return; + + while (_hints[_i] != NULL) + { + char *_key = _hints[_i]; + char *_val = NULL; + char *_str = NULL; + + // The hints we are looking for are in the form of a key/value pair. + // Separate the key from the value without copy. + _str = strchr (_key, '='); + if (_str != NULL) + { + _val = _str + 1; + *_str = '\0'; + } + + if (strcasecmp("mpool", _key) == 0) + { + if (_val != NULL && strcasecmp ("sicm", _val) == 0) + { + // This module is the target of the request + _priority = 100; + } + } + + if (strcasecmp("sicm_device_type", _key) == 0) + { + // Because SICM does not define enums in a precise way, we need to explicitely + // figure out what the tag is + if (strcmp (_val, "SICM_KNL_HBM") == 0) + device_type = SICM_KNL_HBM; + + if (strcmp (_val, "SICM_POWERPC_HBM") == 0) + device_type = SICM_POWERPC_HBM; + + } + + // TODO: make sure we get all the hints to drive the memory operation + + _i++; + } + + opal_argv_free (_hints); + } + + if (_priority > 0) + { + int i = 0; + mca_mpool_sicm_module_t *_m = NULL; + + // We find the SICM module instance that handles the target type of device + do + { + if (mca_mpool_sicm_component.modules[i]->target_device_type == device_type) + { + _m = mca_mpool_sicm_component.modules[i]; + break; + } + + if (mca_mpool_sicm_component.modules[i]->target_device_type == INVALID_TAG) + { + mca_mpool_sicm_component.modules[i]->target_device_type = device_type; + _m = mca_mpool_sicm_component.modules[i]; + break; + } + + i++; + } while (i < mca_mpool_sicm_component.module_count); + + if (_m == NULL) + { + // We did not find a suitable module so we create a new one + _mpool_sicm_extend_module_list (); + assert (mca_mpool_sicm_component.modules[mca_mpool_sicm_component.module_count]->target_device_type == INVALID_TAG); + _m = mca_mpool_sicm_component.modules[mca_mpool_sicm_component.module_count]; + _m->target_device_type = device_type; + } + + *module = (mca_mpool_base_module_t*)_m; + } + + *priority = _priority; +} + +static int +mpool_sicm_query (const char *hints, int *priority, mca_mpool_base_module_t **module) +{ + + // hints is a string of comma-sperated keys that are used to pass parameters in + if (hints) + { + // Parse the list of hints + _parse_hints (hints, priority, module); + } + else + { + *priority = 0; + } + + return OPAL_SUCCESS; +} + diff --git a/opal/mca/mpool/sicm/mpool_sicm_module.c b/opal/mca/mpool/sicm/mpool_sicm_module.c new file mode 100644 index 00000000000..aa6d8a028e3 --- /dev/null +++ b/opal/mca/mpool/sicm/mpool_sicm_module.c @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2018 UT-Battelle, LLC + * All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADERS$ + */ + +#include "opal_config.h" + +#include "opal/mca/mpool/base/base.h" +#include "opal/mca/mpool/sicm/mpool_sicm.h" + +static void* mpool_sicm_alloc (mca_mpool_base_module_t *module, size_t size, size_t align, uint32_t flags); +static void* mpool_sicm_realloc (mca_mpool_base_module_t *module, void *addr, size_t size); +static void mpool_sicm_free (mca_mpool_base_module_t *module, void *addr); + +mca_mpool_sicm_module_t mca_mpool_sicm_module = { + .super = { + .mpool_component = &mca_mpool_sicm_component.super, + .mpool_alloc = mpool_sicm_alloc, + .mpool_realloc = mpool_sicm_realloc, + .mpool_free = mpool_sicm_free, + }, + .sicm_is_initialized = false, +}; + +int +mpool_sicm_module_init (mca_mpool_sicm_module_t *module) +{ + module->super.mpool_component = &mca_mpool_sicm_component.super; + module->super.mpool_base = NULL; + module->super.mpool_alloc = mpool_sicm_alloc; + module->super.mpool_realloc = mpool_sicm_realloc; + module->super.mpool_free = mpool_sicm_free; + module->super.mpool_finalize = mpool_sicm_finalize; + module->super.mpool_ft_event = NULL; + module->super.flags = MCA_MPOOL_FLAGS_MPI_ALLOC_MEM; + + OBJ_CONSTRUCT (&module->lock, opal_mutex_t); + + mca_mpool_sicm_component.devices = sicm_init (); + module->target_device_type = INVALID_TAG; + module->sicm_is_initialized = true; + + return OPAL_SUCCESS; +} + +static void* +mpool_sicm_alloc (mca_mpool_base_module_t *module, size_t size, size_t align, uint32_t flags) +{ + sicm_arena arena; + void *mem = NULL; + sicm_device *dev; + sicm_device_tag device_tag = SICM_DRAM; + mca_mpool_sicm_module_t *_m; + + _m = (mca_mpool_sicm_module_t*)module; + + if (_m->sicm_is_initialized == false) + mpool_sicm_module_init (_m); + + if (flags == SICM_DRAM) + device_tag = SICM_DRAM; + + if (flags == SICM_KNL_HBM) + device_tag = SICM_KNL_HBM; + + if (flags == SICM_POWERPC_HBM) + device_tag = SICM_POWERPC_HBM; + + dev = sicm_find_device (&mca_mpool_sicm_component.devices, device_tag, 0, NULL); + if (dev == NULL) + return NULL; + + arena = sicm_arena_create (0, dev); + if (arena == NULL) + return NULL; + + if (align > 0) + mem = sicm_arena_alloc_aligned (arena, size, align); + else + mem = sicm_arena_alloc (arena, size); + + return mem; +} + +static void* +mpool_sicm_realloc (mca_mpool_base_module_t *module, void *addr, size_t size) +{ + sicm_arena arena; + + arena = sicm_arena_lookup (addr); + if (arena == NULL) + return NULL; + + return sicm_arena_realloc (arena, addr, size); +} + +static void +mpool_sicm_free (mca_mpool_base_module_t *module, void *addr) +{ + sicm_arena arena; + + arena = sicm_arena_lookup (addr); + if (arena == NULL) + return; + + sicm_free (addr); + + // No API to destroy an arena - Memory leak +} + +void +mpool_sicm_finalize (mca_mpool_base_module_t *module) +{ + mca_mpool_sicm_module_t *_m = (mca_mpool_sicm_module_t*) module; + + // No function to finalize sicm and/or free devices - Memory leaks + + OBJ_DESTRUCT (&_m->lock); +} From 6969b9948ea11626e2eb8dd45881af0206b30fd2 Mon Sep 17 00:00:00 2001 From: Thomas Naughton Date: Tue, 11 Aug 2020 15:35:32 -0400 Subject: [PATCH 28/31] add arg for sicm_arena_create() and fix header - Add arg for newer SICM API in sicm_arena_create() - Fix header path for OMPI master include 'mutex_unix.h' Signed-off-by: Thomas Naughton --- opal/mca/mpool/sicm/mpool_sicm.h | 2 +- opal/mca/mpool/sicm/mpool_sicm_module.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/mpool/sicm/mpool_sicm.h b/opal/mca/mpool/sicm/mpool_sicm.h index fcc80f5fa62..a0ed2e4a6ea 100644 --- a/opal/mca/mpool/sicm/mpool_sicm.h +++ b/opal/mca/mpool/sicm/mpool_sicm.h @@ -14,7 +14,7 @@ #define MCA_MPOOL_SICM_H #include "opal_config.h" -#include "opal/threads/mutex_unix.h" +#include "opal/mca/threads/mutex.h" #include "opal/mca/event/event.h" #include "opal/mca/mpool/mpool.h" diff --git a/opal/mca/mpool/sicm/mpool_sicm_module.c b/opal/mca/mpool/sicm/mpool_sicm_module.c index aa6d8a028e3..4b4c0dada43 100644 --- a/opal/mca/mpool/sicm/mpool_sicm_module.c +++ b/opal/mca/mpool/sicm/mpool_sicm_module.c @@ -76,7 +76,7 @@ mpool_sicm_alloc (mca_mpool_base_module_t *module, size_t size, size_t align, ui if (dev == NULL) return NULL; - arena = sicm_arena_create (0, dev); + arena = sicm_arena_create (0, SICM_ALLOC_RELAXED, dev); if (arena == NULL) return NULL; From 473be487aaad2b62b05415379752a2a7699f2e30 Mon Sep 17 00:00:00 2001 From: Thomas Naughton Date: Sat, 10 Oct 2020 13:15:52 -0400 Subject: [PATCH 29/31] mpool/sicm: fixes for multi-module and verbose output - Fixes issues encountered while testing on Summit w/ HBM - Avoids multiple calls to sicm_init() to set device list - Adds ability to have more than one device type (module list) - Adds call to sicm_arena_destroy() during free - Adds opal outputs, verbose/debug (dump device info, etc.) Signed-off-by: Thomas Naughton --- opal/mca/mpool/sicm/mpool_sicm.h | 3 + opal/mca/mpool/sicm/mpool_sicm_component.c | 83 +++++++++-- opal/mca/mpool/sicm/mpool_sicm_module.c | 160 ++++++++++++++++++++- 3 files changed, 229 insertions(+), 17 deletions(-) diff --git a/opal/mca/mpool/sicm/mpool_sicm.h b/opal/mca/mpool/sicm/mpool_sicm.h index a0ed2e4a6ea..ae8a163aafc 100644 --- a/opal/mca/mpool/sicm/mpool_sicm.h +++ b/opal/mca/mpool/sicm/mpool_sicm.h @@ -18,9 +18,12 @@ #include "opal/mca/event/event.h" #include "opal/mca/mpool/mpool.h" +#include "opal/mca/mpool/base/base.h" #include "sicm_low.h" +#define SICM_OUT opal_mpool_base_framework.framework_output + BEGIN_C_DECLS struct mca_mpool_sicm_module_t { diff --git a/opal/mca/mpool/sicm/mpool_sicm_component.c b/opal/mca/mpool/sicm/mpool_sicm_component.c index db136f34178..0a9ef567212 100644 --- a/opal/mca/mpool/sicm/mpool_sicm_component.c +++ b/opal/mca/mpool/sicm/mpool_sicm_component.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2018 UT-Battelle, LLC - * All rights reserved. + * Copyright (c) 2018-2020 UT-Battelle, LLC + * All rights reserved. * * $COPYRIGHT$ * @@ -96,6 +96,8 @@ _mpool_sicm_extend_module_list (void) int n_mods = mca_mpool_sicm_component.module_count + 1; mca_mpool_sicm_module_t *_new_mod = NULL; + opal_output_verbose(5, SICM_OUT, "mpool:sicm module_count = %d\n", n_mods); + if (n_mods == 1) { mca_mpool_sicm_component.modules = (mca_mpool_sicm_module_t**) malloc (sizeof (mca_mpool_sicm_module_t*)); @@ -159,13 +161,17 @@ static void _parse_hints (const char *hints, int *priority, mca_mpool_base_module_t **module) { int _priority = 0; - sicm_device_tag device_type = SICM_DRAM; + //sicm_device_tag device_type = SICM_DRAM; + sicm_device_tag device_type = -1; if (hints) { char **_hints; int _i = 0; + OPAL_OUTPUT_VERBOSE((20, SICM_OUT, + "mpool:sicm DEBUG parsing hints='%s'\n", hints)); + // _hints is NULL terminated _hints = opal_argv_split (hints, ','); if (_hints == NULL) @@ -199,12 +205,29 @@ _parse_hints (const char *hints, int *priority, mca_mpool_base_module_t **module { // Because SICM does not define enums in a precise way, we need to explicitely // figure out what the tag is - if (strcmp (_val, "SICM_KNL_HBM") == 0) + if (strcmp (_val, "SICM_DRAM") == 0) { + device_type = SICM_DRAM; + OPAL_OUTPUT_VERBOSE((10, SICM_OUT, + "mpool:sicm DEBUG type %s (device_type=%d)\n", + "SICM_DRAM", + device_type)); + } + + if (strcmp (_val, "SICM_KNL_HBM") == 0) { device_type = SICM_KNL_HBM; + OPAL_OUTPUT_VERBOSE((10, SICM_OUT, + "mpool:sicm DEBUG type %s (device_type=%d)\n", + "SICM_KNL_HBM", + device_type)); + } - if (strcmp (_val, "SICM_POWERPC_HBM") == 0) + if (strcmp (_val, "SICM_POWERPC_HBM") == 0) { device_type = SICM_POWERPC_HBM; - + OPAL_OUTPUT_VERBOSE((10, SICM_OUT, + "mpool:sicm DEBUG type %s (device_type=%d)\n", + "SICM_POWERPC_HBM", + device_type)); + } } // TODO: make sure we get all the hints to drive the memory operation @@ -220,44 +243,84 @@ _parse_hints (const char *hints, int *priority, mca_mpool_base_module_t **module int i = 0; mca_mpool_sicm_module_t *_m = NULL; + /* If still have sentinal, we likely got back user input */ + if (device_type == -1) { + opal_output_verbose(1, SICM_OUT, + "\n**********************************************************\n" + "mpool:sicm WARN Possibly bad mpool hint 'sicm_device_type'?\n" + "**********************************************************\n"); + } + // We find the SICM module instance that handles the target type of device do { + OPAL_OUTPUT_VERBOSE((20, SICM_OUT, + "mpool:sicm DEBUG MODULE CHECK module[%d].target_device_type = %d, device_type = %d\n", + i, + mca_mpool_sicm_component.modules[i]->target_device_type, + device_type)); + if (mca_mpool_sicm_component.modules[i]->target_device_type == device_type) { + OPAL_OUTPUT_VERBOSE((20, SICM_OUT, + "mpool:sicm DEBUG MODULE FOUND - TARGET_DEVICE_TYPE => %d\n", + device_type)); _m = mca_mpool_sicm_component.modules[i]; break; } +#if 0 if (mca_mpool_sicm_component.modules[i]->target_device_type == INVALID_TAG) { - mca_mpool_sicm_component.modules[i]->target_device_type = device_type; + fprintf(stderr, "WARN: Ignore requests for INVALID_TAG devices - TARGET_DEVICE_TYPE => %d (INVALID_TAG)\n", + mca_mpool_sicm_component.modules[i]->target_device_type); _m = mca_mpool_sicm_component.modules[i]; break; } +#endif i++; } while (i < mca_mpool_sicm_component.module_count); + /* + * TODO: Check if device_type is in list of available devices + * (search component.devices list). Example: May ask + * for KNL_HBM but not on KNL machine so no KNL_HBM device. + * + * if ( _mpool_sicm_check_supported(device_type) ) ... + */ + if (_m == NULL) { + OPAL_OUTPUT_VERBOSE((20, SICM_OUT, + "mpool:sicm DEBUG SICM MPOOL NOT FIND VALID MODULE SO CREATE NEW ONE\n")); + // We did not find a suitable module so we create a new one _mpool_sicm_extend_module_list (); - assert (mca_mpool_sicm_component.modules[mca_mpool_sicm_component.module_count]->target_device_type == INVALID_TAG); - _m = mca_mpool_sicm_component.modules[mca_mpool_sicm_component.module_count]; + assert (mca_mpool_sicm_component.modules[(mca_mpool_sicm_component.module_count - 1)]->target_device_type == INVALID_TAG); + _m = mca_mpool_sicm_component.modules[(mca_mpool_sicm_component.module_count - 1)]; _m->target_device_type = device_type; + + OPAL_OUTPUT_VERBOSE((20, SICM_OUT, + "mpool:sicm DEBUG ASSIGNED device_type=%d to new module (module_count=%d)\n", device_type, mca_mpool_sicm_component.module_count)); } + OPAL_OUTPUT_VERBOSE((20, SICM_OUT, + "mpool:sicm DEBUG SICM MPOOL module.target_device_type=%d\n", + _m->target_device_type)); + *module = (mca_mpool_base_module_t*)_m; } + opal_output_verbose(5, SICM_OUT, + "mpool:sicm SICM priority=%d\n", _priority); + *priority = _priority; } static int mpool_sicm_query (const char *hints, int *priority, mca_mpool_base_module_t **module) { - // hints is a string of comma-sperated keys that are used to pass parameters in if (hints) { diff --git a/opal/mca/mpool/sicm/mpool_sicm_module.c b/opal/mca/mpool/sicm/mpool_sicm_module.c index 4b4c0dada43..8a9f1fcb41b 100644 --- a/opal/mca/mpool/sicm/mpool_sicm_module.c +++ b/opal/mca/mpool/sicm/mpool_sicm_module.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2018 UT-Battelle, LLC - * All rights reserved. + * Copyright (c) 2018-2020 UT-Battelle, LLC + * All rights reserved. * * $COPYRIGHT$ * @@ -18,6 +18,9 @@ static void* mpool_sicm_alloc (mca_mpool_base_module_t *module, size_t size, siz static void* mpool_sicm_realloc (mca_mpool_base_module_t *module, void *addr, size_t size); static void mpool_sicm_free (mca_mpool_base_module_t *module, void *addr); +static int _mpool_sicm_dump_devices(void); +static int _mpool_sicm_show_device_info(struct sicm_device *device, int devnum); + mca_mpool_sicm_module_t mca_mpool_sicm_module = { .super = { .mpool_component = &mca_mpool_sicm_component.super, @@ -28,6 +31,7 @@ mca_mpool_sicm_module_t mca_mpool_sicm_module = { .sicm_is_initialized = false, }; + int mpool_sicm_module_init (mca_mpool_sicm_module_t *module) { @@ -42,10 +46,32 @@ mpool_sicm_module_init (mca_mpool_sicm_module_t *module) OBJ_CONSTRUCT (&module->lock, opal_mutex_t); - mca_mpool_sicm_component.devices = sicm_init (); + /* + * Only initialize the master list of devices once at + * the Component level. Then have Module(s) for each + * of the different device_types. + */ + if (NULL == mca_mpool_sicm_component.devices.devices) { + + mca_mpool_sicm_component.devices = sicm_init (); + + opal_output_verbose(5, SICM_OUT, + "mpool:sicm sicm_init() with device count: %d\n", + mca_mpool_sicm_component.devices.count); + + if (opal_output_check_verbosity(20, SICM_OUT)) { + _mpool_sicm_dump_devices(); + } + + } + module->target_device_type = INVALID_TAG; module->sicm_is_initialized = true; + opal_output_verbose(5, SICM_OUT, + "mpool:sicm module init devices.count: %d\n", + mca_mpool_sicm_component.devices.count); + return OPAL_SUCCESS; } @@ -54,15 +80,27 @@ mpool_sicm_alloc (mca_mpool_base_module_t *module, size_t size, size_t align, ui { sicm_arena arena; void *mem = NULL; - sicm_device *dev; + sicm_device *dev = NULL; sicm_device_tag device_tag = SICM_DRAM; mca_mpool_sicm_module_t *_m; + sicm_device_list devs_list; + int i; _m = (mca_mpool_sicm_module_t*)module; if (_m->sicm_is_initialized == false) mpool_sicm_module_init (_m); + if (_m->target_device_type == SICM_DRAM) + device_tag = SICM_DRAM; + + if (_m->target_device_type == SICM_KNL_HBM) + device_tag = SICM_KNL_HBM; + + if (_m->target_device_type == SICM_POWERPC_HBM) + device_tag = SICM_POWERPC_HBM; + +#if 0 if (flags == SICM_DRAM) device_tag = SICM_DRAM; @@ -71,12 +109,44 @@ mpool_sicm_alloc (mca_mpool_base_module_t *module, size_t size, size_t align, ui if (flags == SICM_POWERPC_HBM) device_tag = SICM_POWERPC_HBM; +#endif + + OPAL_OUTPUT_VERBOSE((20, SICM_OUT, + "mpool:sicm DEBUG sicm_find_device 'device_tag' = %d (%s)\n", + device_tag, + (device_tag == SICM_DRAM)? "SICM_DRAM" : + (device_tag == SICM_POWERPC_HBM)? "SICM_POWERPC_HBM" : + "other")); dev = sicm_find_device (&mca_mpool_sicm_component.devices, device_tag, 0, NULL); - if (dev == NULL) + if (dev == NULL) { + OPAL_OUTPUT_VERBOSE((0, SICM_OUT, + "mpool:sicm ERROR sicm_find_device() failed to find device" + "(device_tag=%d)\n", device_tag)); return NULL; + } + + /* Create temporary list */ + devs_list.count = 1; + devs_list.devices = (struct sicm_device**) malloc(devs_list.count * sizeof(struct sicm_device)); + devs_list.devices[0] = dev; + + if (opal_output_check_verbosity(20, SICM_OUT)) { + opal_output_verbose(1, SICM_OUT, "======DEBUG mpool alloc (begin)========\n"); + for (i = 0; i < devs_list.count; i++) { + struct sicm_device *d = devs_list.devices[i]; + _mpool_sicm_show_device_info(d, -1); + } + opal_output_verbose(1, SICM_OUT, "======DEBUG mpool alloc (end)========\n"); + } + + //arena = sicm_arena_create (0, SICM_ALLOC_RELAXED, dev); + arena = sicm_arena_create (0, SICM_ALLOC_RELAXED, &devs_list); + + if (NULL != devs_list.devices) { + free(devs_list.devices); + } - arena = sicm_arena_create (0, SICM_ALLOC_RELAXED, dev); if (arena == NULL) return NULL; @@ -111,7 +181,7 @@ mpool_sicm_free (mca_mpool_base_module_t *module, void *addr) sicm_free (addr); - // No API to destroy an arena - Memory leak + sicm_arena_destroy(arena); } void @@ -121,5 +191,81 @@ mpool_sicm_finalize (mca_mpool_base_module_t *module) // No function to finalize sicm and/or free devices - Memory leaks + /* + * TODO: (TJN) Free the module from component list, + * Call sicm_fini() to release the devices, + * Free component device list. + * But make sure not happen multiple times, + * and that sicm_fini is at end. + */ + OBJ_DESTRUCT (&_m->lock); } + + +static int +_mpool_sicm_show_device_info(struct sicm_device *device, int devnum) +{ + if (NULL == device) { + OPAL_OUTPUT_VERBOSE((1, SICM_OUT, + "mpool:sicm ERROR - bad param %s()\n", + __func__)); + return OPAL_ERROR; + } + + sicm_pin(device); + + opal_output(0, "mpool:sicm -----------------------------\n"); + opal_output(0, "mpool:sicm SICM device: %d\n", devnum); + switch(device->tag) { + case SICM_DRAM: + opal_output(0, "mpool:sicm SICM type: SICM_DRAM\n"); + break; + case SICM_KNL_HBM: + opal_output(0, "mpool:sicm SICM type: SICM_KNL_HBM\n"); + break; + case SICM_POWERPC_HBM: + opal_output(0, "mpool:sicm SICM type: SICM_POWERPC_HBM\n"); + break; + case SICM_OPTANE: + opal_output(0, "mpool:sicm SICM type: SICM_OPTANE\n"); + break; + case INVALID_TAG: + opal_output(0, "mpool:sicm SICM type: INVALID_TAG\n"); + break; + default: + opal_output(0, "mpool:sicm SICM type: unknown (bad)\n"); + } + opal_output(0, "mpool:sicm SICM numa node: %d\n", + sicm_numa_id(device)); + opal_output(0, "mpool:sicm SICM page size: %d\n", + sicm_device_page_size(device)); + opal_output(0, "mpool:sicm SICM capacity: %ld\n", + sicm_capacity(device)); + opal_output(0, "mpool:sicm SICM available: %ld\n", + sicm_avail(device)); + opal_output(0, "mpool:sicm -----------------------------\n"); + + return OPAL_SUCCESS; +} + +static int +_mpool_sicm_dump_devices(void) +{ + unsigned int i; + sicm_device *device; + + if (NULL != mca_mpool_sicm_component.devices.devices) { + + for (i=0; i < mca_mpool_sicm_component.devices.count; i++) { + device = mca_mpool_sicm_component.devices.devices[i]; + _mpool_sicm_show_device_info(device, i); + } + + } else { + opal_output(0, "mpool:sicm No SICM devices data.\n"); + return OPAL_ERROR; + } + + return OPAL_SUCCESS; +} From 80525634acf7cc6511f6f9fc251fda713efd98b1 Mon Sep 17 00:00:00 2001 From: Thomas Naughton Date: Sat, 10 Oct 2020 13:23:27 -0400 Subject: [PATCH 30/31] mpool/base: add testing envvar OMPIX_MPOOL_NO_FALLBACK Set envvar `OMPIX_MPOOL_NO_FALLBACK` to avoid fallback to malloc(). This should probably be an MCA but quick fix for mpool testing. Signed-off-by: Thomas Naughton --- opal/mca/mpool/base/mpool_base_alloc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/opal/mca/mpool/base/mpool_base_alloc.c b/opal/mca/mpool/base/mpool_base_alloc.c index b75d8b07ad6..c6887c7d379 100644 --- a/opal/mca/mpool/base/mpool_base_alloc.c +++ b/opal/mca/mpool/base/mpool_base_alloc.c @@ -81,10 +81,17 @@ void *mca_mpool_base_alloc(size_t size, opal_info_t *info, const char *hints) } if (NULL == mem) { - /* fall back on malloc */ - mem = malloc(size); - mca_mpool_base_tree_item_put (mpool_tree_item); + /* TJN: Adding quick flag for testing to avoid malloc fallback */ + if ( getenv("OMPIX_MPOOL_NO_FALLBACK") ) { + opal_output(0, "### mpool:base NOTE - Avoiding malloc fallback (OMPIX_MPOOL_NO_FALLBACK is set)\n"); + } else { + /* fall back on malloc */ + mem = malloc(size); + + mca_mpool_base_tree_item_put (mpool_tree_item); + } + } else { mpool_tree_item->mpool = mpool; mpool_tree_item->key = mem; From e0f5c7585292bb9778fae000307a170886d185d7 Mon Sep 17 00:00:00 2001 From: Thomas Naughton Date: Sat, 10 Oct 2020 13:25:31 -0400 Subject: [PATCH 31/31] mpool/sicm: debug macros DBG_ENTER/DBG_EXIT for tracing Signed-off-by: Thomas Naughton --- opal/mca/mpool/sicm/mpool_sicm.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/opal/mca/mpool/sicm/mpool_sicm.h b/opal/mca/mpool/sicm/mpool_sicm.h index ae8a163aafc..4c41537d9cf 100644 --- a/opal/mca/mpool/sicm/mpool_sicm.h +++ b/opal/mca/mpool/sicm/mpool_sicm.h @@ -26,6 +26,23 @@ BEGIN_C_DECLS + +/* TJN: Temporary debug macros (these should be removed) */ +#define DBG_ENTER(m) \ + do { \ + OPAL_OUTPUT_VERBOSE((100, SICM_OUT, \ + "DBG: >> ENTER %s() %s\n", \ + __func__, m)); \ + } while(0) + +#define DBG_EXIT(m) \ + do { \ + OPAL_OUTPUT_VERBOSE((100, SICM_OUT, \ + "DBG: << EXIT %s() %s\n", \ + __func__, m)); \ + } while(0) + + struct mca_mpool_sicm_module_t { mca_mpool_base_module_t super; bool sicm_is_initialized;